MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / applyLocalOnlyGitignore

Function applyLocalOnlyGitignore

src/bin/codegraph.ts:707–726  ·  view source on GitHub ↗

`init --local-only`: make the project's `.gitignore` ignore itself, and say what happened.

(
  clack: { log: { success(message: string): void; info(message: string): void; warn(message: string): void } },
  projectPath: string,
)

Source from the content-addressed store, hash-verified

705
706/** `init --local-only`: make the project's `.gitignore` ignore itself, and say what happened. */
707function applyLocalOnlyGitignore(
708 clack: { log: { success(message: string): void; info(message: string): void; warn(message: string): void } },
709 projectPath: string,
710): void {
711 const file = `${path.basename(getCodeGraphDir(projectPath))}/.gitignore`;
712 switch (makeGitignoreLocalOnly(projectPath)) {
713 case 'written':
714 clack.log.success(`${file} now ignores itself, so nothing of CodeGraph's shows in git.`);
715 break;
716 case 'unchanged':
717 clack.log.info(`${file} already ignores itself.`);
718 break;
719 case 'customized':
720 clack.log.warn(`Left ${file} as it is because it has your own rules. A lone * in it would keep the whole folder out of git.`);
721 break;
722 case 'tracked':
723 clack.log.warn(`Left ${file} as it is because it is committed to this repository, so changing it would show up in git.`);
724 break;
725 }
726}
727
728/**
729 * The `init` flow — shared by `codegraph init` and `codegraph install --init`

Callers 1

runInitFunction · 0.85

Calls 4

getCodeGraphDirFunction · 0.90
makeGitignoreLocalOnlyFunction · 0.90
infoMethod · 0.80
warnMethod · 0.80

Tested by

no test coverage detected