MCPcopy Create free account
hub / github.com/Wirasm/kild / worktree

Function worktree

engine/src/cli.ts:119–169  ·  view source on GitHub ↗
(action: string | undefined, args: string[])

Source from the content-addressed store, hash-verified

117 return kildSpawn(action, values.as);
118 }
119 case 'rm': {
120 if (!action) throw new Error('usage: kild rm <id|worktree-name> [--force]');
121 return kildRm(action);
122 }
123 case 'land': {
124 if (!action) throw new Error('usage: kild land <id|worktree-name> [--execute]');
125 return kildLand(action);
126 }
127 case 'attach':
128 return kildAttach(action);
129 case 'inbox':
130 return kildInbox(action);
131 case 'watch':
132 return kildWatch(action);
133 case 'log': {
134 if (!action) throw new Error('usage: kild log <id>');
135 return kildLog(action);
136 }
137 case 'show': {
138 if (!action) throw new Error('usage: kild show <id>');
139 return kildShow(action);
140 }
141 case 'agents':
142 return agentsList();
143 default:
144 console.error(
145 'usage: kild <ls|new|send|spawn|stop|rm|land|attach|inbox|watch|log|show|agents|persona|project|run> …',
146 );
147 process.exit(2);
148 }
149}
150
151async function project(action: string | undefined, args: string[]): Promise<void> {
152 if (action === 'ls') {
153 const projects = await loadProjects();
154 if (json) return void console.log(JSON.stringify(projects, null, 2));
155 if (projects.length === 0) return void console.error('no projects registered');
156 for (const p of projects) console.log(`${p.name}\t${p.path}`);
157 } else if (action === 'add') {
158 const [name, path] = args;
159 if (!name || !path) throw new Error('usage: kild project add <name> <path>');
160 const p = await addProject(name, path);
161 console.log(json ? JSON.stringify(p, null, 2) : `added ${p.name} → ${p.path}`);
162 } else if (action === 'rm') {
163 const [name] = args;
164 if (!name) throw new Error('usage: kild project rm <name>');
165 await removeProject(name);
166 if (!json) console.log(`removed ${name}`);
167 } else {
168 throw new Error('usage: kild project <ls|add|rm>');
169 }
170}
171
172/** `--project` is a name-or-path union: a registered project's name, or a path to a

Callers 1

dispatchFunction · 0.70

Calls 7

findProjectFunction · 0.90
listWorktreesFunction · 0.90
removeWorktreeFunction · 0.90
worktreePathFunction · 0.90
pruneMergedWorktreesFunction · 0.90
engineFetchFunction · 0.85
joinMethod · 0.80

Tested by

no test coverage detected