ralphctl 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +29 -16
  2. package/dist/absolute-path-WUTZQ37D.mjs +8 -0
  3. package/dist/chunk-6RDMCLWU.mjs +108 -0
  4. package/dist/chunk-HIU74KTO.mjs +1046 -0
  5. package/dist/chunk-S3PTDH57.mjs +78 -0
  6. package/dist/chunk-WV4D2CPG.mjs +26 -0
  7. package/dist/cli.mjs +22413 -717
  8. package/dist/manifest.json +24 -0
  9. package/dist/prompt-adapter-JQICGVX7.mjs +7 -0
  10. package/dist/prompts/ideate.md +3 -1
  11. package/dist/prompts/plan-auto.md +23 -8
  12. package/dist/prompts/plan-common-examples.md +3 -3
  13. package/dist/prompts/plan-common.md +6 -5
  14. package/dist/prompts/plan-interactive.md +30 -7
  15. package/dist/prompts/repo-onboard.md +154 -64
  16. package/dist/prompts/signals-task.md +3 -0
  17. package/dist/prompts/sprint-feedback.md +3 -0
  18. package/dist/prompts/task-evaluation.md +74 -53
  19. package/dist/prompts/task-execution.md +65 -21
  20. package/dist/prompts/ticket-refine.md +11 -8
  21. package/dist/prompts/validation-checklist.md +3 -2
  22. package/dist/skills/default/abstraction-first/SKILL.md +45 -0
  23. package/dist/skills/default/alignment/SKILL.md +46 -0
  24. package/dist/skills/default/iterative-review/SKILL.md +48 -0
  25. package/dist/skills/exec/.gitkeep +0 -0
  26. package/dist/skills/plan/.gitkeep +0 -0
  27. package/dist/skills/refine/.gitkeep +0 -0
  28. package/dist/storage-paths-IPNZZM5D.mjs +15 -0
  29. package/dist/validation-error-QT6Q7FYU.mjs +7 -0
  30. package/package.json +14 -9
  31. package/dist/add-67UFUI54.mjs +0 -17
  32. package/dist/add-DVPVHENV.mjs +0 -18
  33. package/dist/bootstrap-FMHG6DRY.mjs +0 -11
  34. package/dist/chunk-62HYDA7L.mjs +0 -1128
  35. package/dist/chunk-747KW2RW.mjs +0 -24
  36. package/dist/chunk-BSB4EDGR.mjs +0 -260
  37. package/dist/chunk-BT5FKIZX.mjs +0 -787
  38. package/dist/chunk-CBMFRQ4Y.mjs +0 -441
  39. package/dist/chunk-CFUVE2BP.mjs +0 -16
  40. package/dist/chunk-D6QZNEYN.mjs +0 -5520
  41. package/dist/chunk-FNAAA32W.mjs +0 -103
  42. package/dist/chunk-GQ2WFKBN.mjs +0 -269
  43. package/dist/chunk-IWXBJD2D.mjs +0 -27
  44. package/dist/chunk-OGEXYSFS.mjs +0 -228
  45. package/dist/chunk-VAZ3LJBI.mjs +0 -179
  46. package/dist/chunk-WDMLPXOD.mjs +0 -363
  47. package/dist/chunk-XN2UIHBY.mjs +0 -589
  48. package/dist/chunk-ZE2BRQA2.mjs +0 -5542
  49. package/dist/create-Z635FQKO.mjs +0 -15
  50. package/dist/handle-23EFF3BE.mjs +0 -22
  51. package/dist/mount-NCYR22SN.mjs +0 -7434
  52. package/dist/project-DQHF4ISP.mjs +0 -34
  53. package/dist/prompts/check-script-discover.md +0 -69
  54. package/dist/prompts/ideate-auto.md +0 -195
  55. package/dist/prompts/task-evaluation-resume.md +0 -41
  56. package/dist/resolver-OVPYVW6Q.mjs +0 -163
  57. package/dist/sprint-4E26AB5F.mjs +0 -38
  58. package/dist/start-T34NI3LF.mjs +0 -19
@@ -1,24 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/integration/bootstrap.ts
4
- var _shared = null;
5
- function getSharedDeps() {
6
- if (!_shared) {
7
- throw new Error(
8
- "SharedDeps not initialised \u2014 the application entrypoint must call setSharedDeps() before any CLI command runs."
9
- );
10
- }
11
- return _shared;
12
- }
13
- function setSharedDeps(deps) {
14
- _shared = deps;
15
- }
16
- function getPrompt() {
17
- return getSharedDeps().prompt;
18
- }
19
-
20
- export {
21
- getSharedDeps,
22
- setSharedDeps,
23
- getPrompt
24
- };
@@ -1,260 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- ProjectsSchema,
4
- expandTilde,
5
- fileExists,
6
- generateUuid8,
7
- getProjectsFilePath,
8
- readValidatedJson,
9
- validateProjectPath,
10
- writeValidatedJson
11
- } from "./chunk-WDMLPXOD.mjs";
12
- import {
13
- ParseError,
14
- ProjectExistsError,
15
- ProjectNotFoundError,
16
- ValidationError
17
- } from "./chunk-VAZ3LJBI.mjs";
18
-
19
- // src/integration/persistence/project.ts
20
- import { basename, resolve } from "path";
21
- function migrateProjectIfNeeded(project) {
22
- const id = project.id ?? generateUuid8();
23
- if (project.paths && !project.repositories) {
24
- return {
25
- id,
26
- name: project.name,
27
- displayName: project.displayName,
28
- repositories: project.paths.map((p) => ({
29
- id: generateUuid8(),
30
- name: basename(p),
31
- path: resolve(expandTilde(p))
32
- })),
33
- description: project.description
34
- };
35
- }
36
- if (project.repositories) {
37
- return {
38
- id,
39
- name: project.name,
40
- displayName: project.displayName,
41
- repositories: project.repositories.map((r) => ({
42
- id: r.id ?? generateUuid8(),
43
- name: r.name,
44
- path: r.path,
45
- checkScript: r.checkScript,
46
- checkTimeout: r.checkTimeout
47
- })),
48
- description: project.description
49
- };
50
- }
51
- throw new ParseError(`Invalid project data: no paths or repositories for ${project.name}`);
52
- }
53
- async function listProjects() {
54
- const filePath = getProjectsFilePath();
55
- if (!await fileExists(filePath)) {
56
- return [];
57
- }
58
- const { readFile } = await import("fs/promises");
59
- const content = await readFile(filePath, "utf-8");
60
- const rawData = JSON.parse(content);
61
- const needsMigration = rawData.some((p) => {
62
- if (!p.id) return true;
63
- if (p.paths && !p.repositories) return true;
64
- return (p.repositories ?? []).some((r) => !r.id);
65
- });
66
- if (needsMigration) {
67
- const migrated = rawData.map(migrateProjectIfNeeded);
68
- const validated = ProjectsSchema.parse(migrated);
69
- const writeResult = await writeValidatedJson(filePath, validated, ProjectsSchema);
70
- if (!writeResult.ok) throw writeResult.error;
71
- return validated;
72
- }
73
- const result = await readValidatedJson(filePath, ProjectsSchema);
74
- if (!result.ok) throw result.error;
75
- const projects = result.value;
76
- const hasTildePaths = projects.some((p) => p.repositories.some((r) => r.path.startsWith("~")));
77
- if (hasTildePaths) {
78
- const corrected = projects.map((project) => ({
79
- ...project,
80
- repositories: project.repositories.map(
81
- (repo) => repo.path.startsWith("~") ? { ...repo, path: resolve(expandTilde(repo.path)) } : repo
82
- )
83
- }));
84
- const validated = ProjectsSchema.parse(corrected);
85
- const writeResult = await writeValidatedJson(filePath, validated, ProjectsSchema);
86
- if (!writeResult.ok) throw writeResult.error;
87
- return validated;
88
- }
89
- return projects;
90
- }
91
- async function getProject(name) {
92
- const projects = await listProjects();
93
- const project = projects.find((p) => p.name === name);
94
- if (!project) {
95
- throw new ProjectNotFoundError(name);
96
- }
97
- return project;
98
- }
99
- async function getProjectById(id) {
100
- const projects = await listProjects();
101
- const project = projects.find((p) => p.id === id);
102
- if (!project) {
103
- throw new ProjectNotFoundError(id);
104
- }
105
- return project;
106
- }
107
- async function getRepoById(repoId) {
108
- const projects = await listProjects();
109
- for (const project of projects) {
110
- const repo = project.repositories.find((r) => r.id === repoId);
111
- if (repo) return { project, repo };
112
- }
113
- throw new ValidationError(`Repository not found: ${repoId}`, "repoId");
114
- }
115
- async function resolveRepoPath(repoId) {
116
- const { repo } = await getRepoById(repoId);
117
- return repo.path;
118
- }
119
- async function projectExists(name) {
120
- const projects = await listProjects();
121
- return projects.some((p) => p.name === name);
122
- }
123
- async function createProject(input) {
124
- const projects = await listProjects();
125
- if (projects.some((p) => p.name === input.name)) {
126
- throw new ProjectExistsError(input.name);
127
- }
128
- const pathErrors = [];
129
- for (const repo of input.repositories) {
130
- const resolved = resolve(expandTilde(repo.path));
131
- const validation = await validateProjectPath(resolved);
132
- if (!validation.ok) {
133
- pathErrors.push(` ${repo.path}: ${validation.error.message}`);
134
- }
135
- }
136
- if (pathErrors.length > 0) {
137
- throw new ValidationError(`Invalid project paths:
138
- ${pathErrors.join("\n")}`, "repositories");
139
- }
140
- const normalizedProject = {
141
- id: input.id ?? generateUuid8(),
142
- name: input.name,
143
- displayName: input.displayName,
144
- description: input.description,
145
- repositories: input.repositories.map((repo) => {
146
- const resolvedPath = resolve(expandTilde(repo.path));
147
- return {
148
- id: repo.id ?? generateUuid8(),
149
- name: repo.name && repo.name.length > 0 ? repo.name : basename(resolvedPath),
150
- path: resolvedPath,
151
- checkScript: repo.checkScript,
152
- checkTimeout: repo.checkTimeout
153
- };
154
- })
155
- };
156
- projects.push(normalizedProject);
157
- const writeResult = await writeValidatedJson(getProjectsFilePath(), projects, ProjectsSchema);
158
- if (!writeResult.ok) throw writeResult.error;
159
- return normalizedProject;
160
- }
161
- async function updateProject(name, updates) {
162
- const projects = await listProjects();
163
- const index = projects.findIndex((p) => p.name === name);
164
- if (index === -1) {
165
- throw new ProjectNotFoundError(name);
166
- }
167
- if (updates.repositories) {
168
- const pathErrors = [];
169
- for (const repo of updates.repositories) {
170
- const resolved = resolve(expandTilde(repo.path));
171
- const validation = await validateProjectPath(resolved);
172
- if (!validation.ok) {
173
- pathErrors.push(` ${repo.path}: ${validation.error.message}`);
174
- }
175
- }
176
- if (pathErrors.length > 0) {
177
- throw new ValidationError(`Invalid project paths:
178
- ${pathErrors.join("\n")}`, "repositories");
179
- }
180
- updates.repositories = updates.repositories.map((repo) => ({
181
- id: repo.id.length > 0 ? repo.id : generateUuid8(),
182
- name: repo.name && repo.name.length > 0 ? repo.name : basename(resolve(expandTilde(repo.path))),
183
- path: resolve(expandTilde(repo.path)),
184
- checkScript: repo.checkScript,
185
- checkTimeout: repo.checkTimeout
186
- }));
187
- }
188
- const existingProject = projects[index];
189
- if (!existingProject) {
190
- throw new ProjectNotFoundError(name);
191
- }
192
- const updatedProject = {
193
- id: existingProject.id,
194
- name: existingProject.name,
195
- displayName: updates.displayName ?? existingProject.displayName,
196
- repositories: updates.repositories ?? existingProject.repositories,
197
- description: updates.description ?? existingProject.description
198
- };
199
- projects[index] = updatedProject;
200
- const writeResult = await writeValidatedJson(getProjectsFilePath(), projects, ProjectsSchema);
201
- if (!writeResult.ok) throw writeResult.error;
202
- return updatedProject;
203
- }
204
- async function removeProject(name) {
205
- const projects = await listProjects();
206
- const index = projects.findIndex((p) => p.name === name);
207
- if (index === -1) {
208
- throw new ProjectNotFoundError(name);
209
- }
210
- projects.splice(index, 1);
211
- const writeResult = await writeValidatedJson(getProjectsFilePath(), projects, ProjectsSchema);
212
- if (!writeResult.ok) throw writeResult.error;
213
- }
214
- async function addProjectRepo(name, repo) {
215
- const project = await getProject(name);
216
- const resolvedPath = resolve(expandTilde(repo.path));
217
- const validation = await validateProjectPath(resolvedPath);
218
- if (!validation.ok) {
219
- throw new ValidationError(`Invalid path ${repo.path}: ${validation.error.message}`, repo.path);
220
- }
221
- if (project.repositories.some((r) => r.path === resolvedPath)) {
222
- return project;
223
- }
224
- const normalizedRepo = {
225
- id: repo.id ?? generateUuid8(),
226
- name: repo.name && repo.name.length > 0 ? repo.name : basename(resolvedPath),
227
- path: resolvedPath,
228
- checkScript: repo.checkScript,
229
- checkTimeout: repo.checkTimeout
230
- };
231
- return updateProject(name, {
232
- repositories: [...project.repositories, normalizedRepo]
233
- });
234
- }
235
- async function removeProjectRepo(name, path) {
236
- const project = await getProject(name);
237
- const resolvedPath = resolve(expandTilde(path));
238
- const newRepos = project.repositories.filter((r) => r.path !== resolvedPath);
239
- if (newRepos.length === 0) {
240
- throw new ValidationError("Cannot remove the last repository from a project", "repositories");
241
- }
242
- if (newRepos.length === project.repositories.length) {
243
- return project;
244
- }
245
- return updateProject(name, { repositories: newRepos });
246
- }
247
-
248
- export {
249
- listProjects,
250
- getProject,
251
- getProjectById,
252
- getRepoById,
253
- resolveRepoPath,
254
- projectExists,
255
- createProject,
256
- updateProject,
257
- removeProject,
258
- addProjectRepo,
259
- removeProjectRepo
260
- };