ralphctl 0.1.1 → 0.1.3

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.
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ sprintCreateCommand
4
+ } from "./chunk-DZ6HHTM5.mjs";
5
+ import "./chunk-LFDW6MWF.mjs";
6
+ import "./chunk-OEUJDSHY.mjs";
7
+ import "./chunk-W3TY22IS.mjs";
8
+ import "./chunk-EDJX7TT6.mjs";
9
+ import "./chunk-QBXHAXHI.mjs";
10
+ export {
11
+ sprintCreateCommand
12
+ };
@@ -7,7 +7,7 @@ async function handleCompletionRequest(program) {
7
7
  return false;
8
8
  }
9
9
  const tabtab = (await import("tabtab")).default;
10
- const { resolveCompletions } = await import("./resolver-HHMON7RK.mjs");
10
+ const { resolveCompletions } = await import("./resolver-NH34HTB6.mjs");
11
11
  const tabEnv = tabtab.parseEnv(env);
12
12
  const completions = await resolveCompletions(program, {
13
13
  line: tabEnv.line,
@@ -1,7 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- ProjectExistsError,
4
- ProjectNotFoundError,
5
3
  addProjectRepo,
6
4
  createProject,
7
5
  getProject,
@@ -11,8 +9,12 @@ import {
11
9
  removeProject,
12
10
  removeProjectRepo,
13
11
  updateProject
14
- } from "./chunk-35KGXPBU.mjs";
15
- import "./chunk-4C24UQ3X.mjs";
12
+ } from "./chunk-PDI6HBZ7.mjs";
13
+ import "./chunk-W3TY22IS.mjs";
14
+ import {
15
+ ProjectExistsError,
16
+ ProjectNotFoundError
17
+ } from "./chunk-EDJX7TT6.mjs";
16
18
  export {
17
19
  ProjectExistsError,
18
20
  ProjectNotFoundError,
@@ -1,15 +1,23 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ wrapAsync
4
+ } from "./chunk-OEUJDSHY.mjs";
5
+ import {
6
+ IOError
7
+ } from "./chunk-EDJX7TT6.mjs";
2
8
 
3
9
  // src/completion/resolver.ts
4
10
  var dynamicResolvers = {
5
11
  "--project": async () => {
6
- try {
7
- const { listProjects } = await import("./project-BG7VHACC.mjs");
8
- const projects = await listProjects();
9
- return projects.map((p) => ({ name: p.name, description: p.displayName }));
10
- } catch {
11
- return [];
12
- }
12
+ const result = await wrapAsync(
13
+ async () => {
14
+ const { listProjects } = await import("./project-Q4LKML42.mjs");
15
+ return listProjects();
16
+ },
17
+ (err) => new IOError("Failed to load projects for completion", err instanceof Error ? err : void 0)
18
+ );
19
+ if (!result.ok) return [];
20
+ return result.value.map((p) => ({ name: p.name, description: p.displayName }));
13
21
  },
14
22
  "--status": () => {
15
23
  return Promise.resolve([
@@ -35,16 +43,18 @@ var configValueCompletions = {
35
43
  ]
36
44
  };
37
45
  async function getSprintCompletions() {
38
- try {
39
- const { listSprints } = await import("./sprint-FJVU7HRC.mjs");
40
- const sprints = await listSprints();
41
- return sprints.map((s) => ({
42
- name: s.id,
43
- description: `${s.name} (${s.status})`
44
- }));
45
- } catch {
46
- return [];
47
- }
46
+ const result = await wrapAsync(
47
+ async () => {
48
+ const { listSprints } = await import("./sprint-UHYXSEBJ.mjs");
49
+ return listSprints();
50
+ },
51
+ (err) => new IOError("Failed to load sprints for completion", err instanceof Error ? err : void 0)
52
+ );
53
+ if (!result.ok) return [];
54
+ return result.value.map((s) => ({
55
+ name: s.id,
56
+ description: `${s.name} (${s.status})`
57
+ }));
48
58
  }
49
59
  function getSubcommands(cmd) {
50
60
  return cmd.commands.map((sub) => ({
@@ -1,8 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- NoCurrentSprintError,
4
- SprintNotFoundError,
5
- SprintStatusError,
6
3
  activateSprint,
7
4
  assertSprintStatus,
8
5
  closeSprint,
@@ -15,8 +12,14 @@ import {
15
12
  listSprints,
16
13
  resolveSprintId,
17
14
  saveSprint
18
- } from "./chunk-VCZGS3UD.mjs";
19
- import "./chunk-4C24UQ3X.mjs";
15
+ } from "./chunk-LFDW6MWF.mjs";
16
+ import "./chunk-OEUJDSHY.mjs";
17
+ import "./chunk-W3TY22IS.mjs";
18
+ import {
19
+ NoCurrentSprintError,
20
+ SprintNotFoundError,
21
+ SprintStatusError
22
+ } from "./chunk-EDJX7TT6.mjs";
20
23
  import "./chunk-QBXHAXHI.mjs";
21
24
  export {
22
25
  NoCurrentSprintError,
@@ -3,21 +3,26 @@ import {
3
3
  sprintPlanCommand,
4
4
  sprintRefineCommand,
5
5
  sprintStartCommand
6
- } from "./chunk-OFKKZ6SW.mjs";
7
- import "./chunk-NTWO2LXB.mjs";
6
+ } from "./chunk-M7JV6MKD.mjs";
7
+ import "./chunk-7LZ6GOGN.mjs";
8
8
  import {
9
9
  sprintCreateCommand
10
- } from "./chunk-NC3A3T2Z.mjs";
10
+ } from "./chunk-DZ6HHTM5.mjs";
11
11
  import {
12
12
  addSingleTicketInteractive
13
- } from "./chunk-IDLFGCG7.mjs";
13
+ } from "./chunk-F2MMCTB5.mjs";
14
14
  import "./chunk-7TG3EAQ2.mjs";
15
- import "./chunk-35KGXPBU.mjs";
15
+ import "./chunk-PDI6HBZ7.mjs";
16
16
  import {
17
17
  getCurrentSprint,
18
18
  getSprint
19
- } from "./chunk-VCZGS3UD.mjs";
20
- import "./chunk-4C24UQ3X.mjs";
19
+ } from "./chunk-LFDW6MWF.mjs";
20
+ import {
21
+ ensureError,
22
+ wrapAsync
23
+ } from "./chunk-OEUJDSHY.mjs";
24
+ import "./chunk-W3TY22IS.mjs";
25
+ import "./chunk-EDJX7TT6.mjs";
21
26
  import {
22
27
  colors,
23
28
  emoji,
@@ -41,18 +46,15 @@ function showStepProgress(step, title) {
41
46
  log.newline();
42
47
  }
43
48
  async function runWizard() {
44
- try {
49
+ const r = await wrapAsync(async () => {
45
50
  printHeader("Sprint Setup Wizard", emoji.donut);
46
51
  log.dim("This wizard will guide you through setting up a new sprint.");
47
52
  log.dim("You can skip optional steps along the way.");
48
53
  log.newline();
49
54
  showStepProgress(1, "Create Sprint");
50
- try {
51
- await sprintCreateCommand({ interactive: true });
52
- } catch (err) {
53
- if (err instanceof Error) {
54
- log.error(`Sprint creation failed: ${err.message}`);
55
- }
55
+ const createResult = await wrapAsync(() => sprintCreateCommand({ interactive: true }), ensureError);
56
+ if (!createResult.ok) {
57
+ log.error(`Sprint creation failed: ${createResult.error.message}`);
56
58
  log.newline();
57
59
  showWarning("Cannot continue without a sprint. Wizard aborted.");
58
60
  return;
@@ -66,17 +68,15 @@ async function runWizard() {
66
68
  let ticketCount = 0;
67
69
  let addMore = true;
68
70
  while (addMore) {
69
- try {
70
- const ticket = await addSingleTicketInteractive({});
71
- if (ticket) {
71
+ const ticketResult = await wrapAsync(() => addSingleTicketInteractive({}), ensureError);
72
+ if (ticketResult.ok) {
73
+ if (ticketResult.value) {
72
74
  ticketCount++;
73
75
  } else {
74
76
  break;
75
77
  }
76
- } catch (err) {
77
- if (err instanceof Error) {
78
- log.error(`Failed to add ticket: ${err.message}`);
79
- }
78
+ } else {
79
+ log.error(`Failed to add ticket: ${ticketResult.error.message}`);
80
80
  }
81
81
  log.newline();
82
82
  addMore = await confirm({
@@ -97,12 +97,9 @@ async function runWizard() {
97
97
  default: true
98
98
  });
99
99
  if (shouldRefine) {
100
- try {
101
- await sprintRefineCommand([]);
102
- } catch (err) {
103
- if (err instanceof Error) {
104
- log.error(`Refinement failed: ${err.message}`);
105
- }
100
+ const refineResult = await wrapAsync(() => sprintRefineCommand([]), ensureError);
101
+ if (!refineResult.ok) {
102
+ log.error(`Refinement failed: ${refineResult.error.message}`);
106
103
  log.dim("You can refine later with: ralphctl sprint refine");
107
104
  }
108
105
  } else {
@@ -111,8 +108,9 @@ async function runWizard() {
111
108
  }
112
109
  showStepProgress(4, "Plan Tasks");
113
110
  let canPlan = false;
114
- try {
115
- const sprint = await getSprint(sprintId);
111
+ const sprintCheckResult = await wrapAsync(() => getSprint(sprintId), ensureError);
112
+ if (sprintCheckResult.ok) {
113
+ const sprint = sprintCheckResult.value;
116
114
  const hasTickets = sprint.tickets.length > 0;
117
115
  const allApproved = hasTickets && sprint.tickets.every((t) => t.requirementStatus === "approved");
118
116
  canPlan = allApproved;
@@ -122,7 +120,7 @@ async function runWizard() {
122
120
  log.dim("Skipped -- not all requirements are approved yet.");
123
121
  log.dim("Refine first with: ralphctl sprint refine");
124
122
  }
125
- } catch {
123
+ } else {
126
124
  log.dim("Skipped -- could not read sprint state.");
127
125
  }
128
126
  if (canPlan) {
@@ -131,12 +129,9 @@ async function runWizard() {
131
129
  default: true
132
130
  });
133
131
  if (shouldPlan) {
134
- try {
135
- await sprintPlanCommand([]);
136
- } catch (err) {
137
- if (err instanceof Error) {
138
- log.error(`Planning failed: ${err.message}`);
139
- }
132
+ const planResult = await wrapAsync(() => sprintPlanCommand([]), ensureError);
133
+ if (!planResult.ok) {
134
+ log.error(`Planning failed: ${planResult.error.message}`);
140
135
  log.dim("You can plan later with: ralphctl sprint plan");
141
136
  }
142
137
  } else {
@@ -149,12 +144,13 @@ async function runWizard() {
149
144
  default: false
150
145
  });
151
146
  if (shouldStart) {
152
- try {
153
- await sprintStartCommand([]);
154
- } catch (err) {
155
- if (err instanceof Error) {
156
- log.error(`Execution failed: ${err.message}`);
157
- }
147
+ const startResult = await wrapAsync(
148
+ // Note: sprintStartCommand may call process.exit() on completion
149
+ () => sprintStartCommand([]),
150
+ ensureError
151
+ );
152
+ if (!startResult.ok) {
153
+ log.error(`Execution failed: ${startResult.error.message}`);
158
154
  }
159
155
  return;
160
156
  }
@@ -162,15 +158,15 @@ async function runWizard() {
162
158
  printSeparator();
163
159
  showSuccess("Wizard complete!");
164
160
  log.newline();
165
- try {
166
- const sprint = await getSprint(sprintId);
161
+ const summaryResult = await wrapAsync(() => getSprint(sprintId), ensureError);
162
+ if (summaryResult.ok) {
163
+ const sprint = summaryResult.value;
167
164
  log.info(`Sprint "${sprint.name}" is ready.`);
168
165
  log.item(`${icons.ticket} ${String(sprint.tickets.length)} ticket(s)`);
169
166
  const approvedCount = sprint.tickets.filter((t) => t.requirementStatus === "approved").length;
170
167
  if (sprint.tickets.length > 0) {
171
168
  log.item(`${icons.success} ${String(approvedCount)}/${String(sprint.tickets.length)} requirements approved`);
172
169
  }
173
- } catch {
174
170
  }
175
171
  log.newline();
176
172
  log.dim("Next steps:");
@@ -181,14 +177,15 @@ async function runWizard() {
181
177
  log.item("ralphctl sprint plan");
182
178
  log.item("ralphctl sprint start");
183
179
  log.newline();
184
- } catch (err) {
185
- if (err.name === "ExitPromptError") {
180
+ }, ensureError);
181
+ if (!r.ok) {
182
+ if (r.error.name === "ExitPromptError") {
186
183
  log.newline();
187
184
  showWarning("Wizard cancelled");
188
185
  log.newline();
189
186
  return;
190
187
  }
191
- throw err;
188
+ throw r.error;
192
189
  }
193
190
  }
194
191
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ralphctl",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Sprint and task management CLI for AI-assisted coding",
5
5
  "homepage": "https://github.com/lukas-grigis/ralphctl",
6
6
  "type": "module",
@@ -43,6 +43,7 @@
43
43
  "gradient-string": "^3.0.0",
44
44
  "ora": "^9.3.0",
45
45
  "tabtab": "^3.0.2",
46
+ "typescript-result": "^3.5.2",
46
47
  "zod": "^4.3.6"
47
48
  },
48
49
  "devDependencies": {
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- sprintCreateCommand
4
- } from "./chunk-NC3A3T2Z.mjs";
5
- import "./chunk-VCZGS3UD.mjs";
6
- import "./chunk-4C24UQ3X.mjs";
7
- import "./chunk-QBXHAXHI.mjs";
8
- export {
9
- sprintCreateCommand
10
- };