opencode-hive 0.4.2 → 0.5.0

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 (43) hide show
  1. package/README.md +0 -2
  2. package/dist/e2e/opencode-runtime-smoke.test.d.ts +1 -0
  3. package/dist/e2e/opencode-runtime-smoke.test.js +243 -0
  4. package/dist/e2e/plugin-smoke.test.d.ts +1 -0
  5. package/dist/e2e/plugin-smoke.test.js +127 -0
  6. package/dist/index.js +273 -75
  7. package/dist/services/contextService.d.ts +15 -0
  8. package/dist/services/contextService.js +59 -0
  9. package/dist/services/featureService.d.ts +0 -2
  10. package/dist/services/featureService.js +1 -11
  11. package/dist/services/featureService.test.d.ts +1 -0
  12. package/dist/services/featureService.test.js +127 -0
  13. package/dist/services/planService.test.d.ts +1 -0
  14. package/dist/services/planService.test.js +115 -0
  15. package/dist/services/sessionService.d.ts +31 -0
  16. package/dist/services/sessionService.js +125 -0
  17. package/dist/services/taskService.d.ts +2 -1
  18. package/dist/services/taskService.js +87 -12
  19. package/dist/services/taskService.test.d.ts +1 -0
  20. package/dist/services/taskService.test.js +159 -0
  21. package/dist/services/worktreeService.js +42 -17
  22. package/dist/services/worktreeService.test.d.ts +1 -0
  23. package/dist/services/worktreeService.test.js +117 -0
  24. package/dist/tools/contextTools.d.ts +93 -0
  25. package/dist/tools/contextTools.js +83 -0
  26. package/dist/tools/execTools.d.ts +3 -9
  27. package/dist/tools/execTools.js +14 -12
  28. package/dist/tools/featureTools.d.ts +4 -48
  29. package/dist/tools/featureTools.js +11 -51
  30. package/dist/tools/planTools.d.ts +5 -15
  31. package/dist/tools/planTools.js +16 -16
  32. package/dist/tools/sessionTools.d.ts +35 -0
  33. package/dist/tools/sessionTools.js +95 -0
  34. package/dist/tools/taskTools.d.ts +6 -18
  35. package/dist/tools/taskTools.js +18 -19
  36. package/dist/types.d.ts +35 -0
  37. package/dist/utils/detection.d.ts +12 -0
  38. package/dist/utils/detection.js +73 -0
  39. package/dist/utils/paths.d.ts +1 -1
  40. package/dist/utils/paths.js +2 -3
  41. package/dist/utils/paths.test.d.ts +1 -0
  42. package/dist/utils/paths.test.js +100 -0
  43. package/package.json +1 -1
@@ -3,6 +3,7 @@ import { z } from 'zod';
3
3
  import { TaskService } from '../services/taskService.js';
4
4
  import { FeatureService } from '../services/featureService.js';
5
5
  import { WorktreeService } from '../services/worktreeService';
6
+ import { detectContext } from '../utils/detection.js';
6
7
  export function createExecTools(projectRoot) {
7
8
  const taskService = new TaskService(projectRoot);
8
9
  const featureService = new FeatureService(projectRoot);
@@ -10,15 +11,18 @@ export function createExecTools(projectRoot) {
10
11
  baseDir: projectRoot,
11
12
  hiveDir: path.join(projectRoot, '.hive'),
12
13
  });
14
+ const getActiveFeature = () => {
15
+ const ctx = detectContext(projectRoot);
16
+ return ctx?.feature || null;
17
+ };
13
18
  return {
14
19
  hive_exec_start: {
15
- description: 'Create a git worktree and begin work on a task. Sets task status to in_progress.',
20
+ description: 'Create worktree and begin work on task',
16
21
  parameters: z.object({
17
22
  task: z.string().describe('Task folder name (e.g., "01-auth-service")'),
18
- featureName: z.string().optional().describe('Feature name (defaults to active feature)'),
19
23
  }),
20
- execute: async ({ task, featureName }) => {
21
- const feature = featureName || featureService.getActive();
24
+ execute: async ({ task }) => {
25
+ const feature = getActiveFeature();
22
26
  if (!feature) {
23
27
  return { error: 'No active feature.' };
24
28
  }
@@ -53,15 +57,14 @@ export function createExecTools(projectRoot) {
53
57
  },
54
58
  },
55
59
  hive_exec_complete: {
56
- description: 'Complete a task: commit changes, apply to main branch, write report, cleanup worktree.',
60
+ description: 'Complete task: apply changes, write report',
57
61
  parameters: z.object({
58
62
  task: z.string().describe('Task folder name'),
59
63
  summary: z.string().describe('Summary of what was done'),
60
64
  report: z.string().optional().describe('Detailed report (markdown). If not provided, summary is used.'),
61
- featureName: z.string().optional().describe('Feature name (defaults to active feature)'),
62
65
  }),
63
- execute: async ({ task, summary, report, featureName }) => {
64
- const feature = featureName || featureService.getActive();
66
+ execute: async ({ task, summary, report }) => {
67
+ const feature = getActiveFeature();
65
68
  if (!feature) {
66
69
  return { error: 'No active feature.' };
67
70
  }
@@ -93,13 +96,12 @@ export function createExecTools(projectRoot) {
93
96
  },
94
97
  },
95
98
  hive_exec_abort: {
96
- description: 'Abort work on a task: discard changes, cleanup worktree, reset status to pending.',
99
+ description: 'Abort task: discard changes, reset status',
97
100
  parameters: z.object({
98
101
  task: z.string().describe('Task folder name'),
99
- featureName: z.string().optional().describe('Feature name (defaults to active feature)'),
100
102
  }),
101
- execute: async ({ task, featureName }) => {
102
- const feature = featureName || featureService.getActive();
103
+ execute: async ({ task }) => {
104
+ const feature = getActiveFeature();
103
105
  if (!feature) {
104
106
  return { error: 'No active feature.' };
105
107
  }
@@ -1,5 +1,4 @@
1
1
  import { z } from 'zod';
2
- import type { TaskInfo } from '../types.js';
3
2
  export declare function createFeatureTools(projectRoot: string): {
4
3
  hive_feature_create: {
5
4
  description: string;
@@ -30,27 +29,14 @@ export declare function createFeatureTools(projectRoot: string): {
30
29
  active: string | null;
31
30
  }>;
32
31
  };
33
- hive_feature_switch: {
34
- description: string;
35
- parameters: z.ZodObject<{
36
- name: z.ZodString;
37
- }, z.core.$strip>;
38
- execute: ({ name }: {
39
- name: string;
40
- }) => Promise<{
41
- switched: boolean;
42
- name: string;
43
- status: import("../types.js").FeatureStatusType | undefined;
44
- message: string;
45
- }>;
46
- };
47
32
  hive_feature_complete: {
48
33
  description: string;
49
34
  parameters: z.ZodObject<{
50
- featureName: z.ZodOptional<z.ZodString>;
35
+ _placeholder: z.ZodBoolean;
36
+ name: z.ZodOptional<z.ZodString>;
51
37
  }, z.core.$strip>;
52
- execute: ({ featureName }: {
53
- featureName?: string;
38
+ execute: ({ name }: {
39
+ name?: string;
54
40
  }) => Promise<{
55
41
  error: string;
56
42
  pendingTasks?: undefined;
@@ -71,34 +57,4 @@ export declare function createFeatureTools(projectRoot: string): {
71
57
  pendingTasks?: undefined;
72
58
  }>;
73
59
  };
74
- hive_status: {
75
- description: string;
76
- parameters: z.ZodObject<{
77
- featureName: z.ZodOptional<z.ZodString>;
78
- }, z.core.$strip>;
79
- execute: ({ featureName }: {
80
- featureName?: string;
81
- }) => Promise<{
82
- error: string;
83
- feature?: undefined;
84
- status?: undefined;
85
- hasPlan?: undefined;
86
- commentCount?: undefined;
87
- tasks?: undefined;
88
- taskSummary?: undefined;
89
- } | {
90
- feature: string;
91
- status: import("../types.js").FeatureStatusType;
92
- hasPlan: boolean;
93
- commentCount: number;
94
- tasks: TaskInfo[];
95
- taskSummary: {
96
- pending: number;
97
- in_progress: number;
98
- done: number;
99
- cancelled: number;
100
- };
101
- error?: undefined;
102
- }>;
103
- };
104
60
  };
@@ -1,7 +1,12 @@
1
1
  import { z } from 'zod';
2
2
  import { FeatureService } from '../services/featureService.js';
3
+ import { detectContext } from '../utils/detection.js';
3
4
  export function createFeatureTools(projectRoot) {
4
5
  const featureService = new FeatureService(projectRoot);
6
+ const getActiveFeature = () => {
7
+ const ctx = detectContext(projectRoot);
8
+ return ctx?.feature || null;
9
+ };
5
10
  return {
6
11
  hive_feature_create: {
7
12
  description: 'Create a new feature and set it as active.',
@@ -24,7 +29,7 @@ export function createFeatureTools(projectRoot) {
24
29
  parameters: z.object({}),
25
30
  execute: async () => {
26
31
  const features = featureService.list();
27
- const active = featureService.getActive();
32
+ const active = getActiveFeature();
28
33
  const details = features.map(name => {
29
34
  const info = featureService.getInfo(name);
30
35
  return {
@@ -37,29 +42,14 @@ export function createFeatureTools(projectRoot) {
37
42
  return { features: details, active };
38
43
  },
39
44
  },
40
- hive_feature_switch: {
41
- description: 'Switch to a different feature.',
42
- parameters: z.object({
43
- name: z.string().describe('Feature name to switch to'),
44
- }),
45
- execute: async ({ name }) => {
46
- featureService.setActive(name);
47
- const info = featureService.getInfo(name);
48
- return {
49
- switched: true,
50
- name,
51
- status: info?.status,
52
- message: `Switched to feature '${name}'`,
53
- };
54
- },
55
- },
56
45
  hive_feature_complete: {
57
- description: 'Mark a feature as completed. This is irreversible.',
46
+ description: 'Mark feature as completed (irreversible)',
58
47
  parameters: z.object({
59
- featureName: z.string().optional().describe('Feature name (defaults to active feature)'),
48
+ _placeholder: z.boolean().describe('Placeholder. Always pass true.'),
49
+ name: z.string().optional(),
60
50
  }),
61
- execute: async ({ featureName }) => {
62
- const feature = featureName || featureService.getActive();
51
+ execute: async ({ name }) => {
52
+ const feature = name || getActiveFeature();
63
53
  if (!feature) {
64
54
  return { error: 'No active feature.' };
65
55
  }
@@ -79,35 +69,5 @@ export function createFeatureTools(projectRoot) {
79
69
  };
80
70
  },
81
71
  },
82
- hive_status: {
83
- description: 'Get overview of the active feature: status, plan, tasks.',
84
- parameters: z.object({
85
- featureName: z.string().optional().describe('Feature name (defaults to active feature)'),
86
- }),
87
- execute: async ({ featureName }) => {
88
- const feature = featureName || featureService.getActive();
89
- if (!feature) {
90
- return { error: 'No active feature. Create one with hive_feature_create.' };
91
- }
92
- const info = featureService.getInfo(feature);
93
- if (!info) {
94
- return { error: `Feature '${feature}' not found` };
95
- }
96
- const tasksByStatus = {
97
- pending: info.tasks.filter((t) => t.status === 'pending').length,
98
- in_progress: info.tasks.filter((t) => t.status === 'in_progress').length,
99
- done: info.tasks.filter((t) => t.status === 'done').length,
100
- cancelled: info.tasks.filter((t) => t.status === 'cancelled').length,
101
- };
102
- return {
103
- feature: info.name,
104
- status: info.status,
105
- hasPlan: info.hasPlan,
106
- commentCount: info.commentCount,
107
- tasks: info.tasks,
108
- taskSummary: tasksByStatus,
109
- };
110
- },
111
- },
112
72
  };
113
73
  }
@@ -4,11 +4,9 @@ export declare function createPlanTools(projectRoot: string): {
4
4
  description: string;
5
5
  parameters: z.ZodObject<{
6
6
  content: z.ZodString;
7
- featureName: z.ZodOptional<z.ZodString>;
8
7
  }, z.core.$strip>;
9
- execute: ({ content, featureName }: {
8
+ execute: ({ content }: {
10
9
  content: string;
11
- featureName?: string;
12
10
  }) => Promise<{
13
11
  error: string;
14
12
  path?: undefined;
@@ -21,23 +19,15 @@ export declare function createPlanTools(projectRoot: string): {
21
19
  };
22
20
  hive_plan_read: {
23
21
  description: string;
24
- parameters: z.ZodObject<{
25
- featureName: z.ZodOptional<z.ZodString>;
26
- }, z.core.$strip>;
27
- execute: ({ featureName }: {
28
- featureName?: string;
29
- }) => Promise<import("../types.js").PlanReadResult | {
22
+ parameters: z.ZodObject<{}, z.core.$strip>;
23
+ execute: () => Promise<import("../types.js").PlanReadResult | {
30
24
  error: string;
31
25
  }>;
32
26
  };
33
27
  hive_plan_approve: {
34
28
  description: string;
35
- parameters: z.ZodObject<{
36
- featureName: z.ZodOptional<z.ZodString>;
37
- }, z.core.$strip>;
38
- execute: ({ featureName }: {
39
- featureName?: string;
40
- }) => Promise<{
29
+ parameters: z.ZodObject<{}, z.core.$strip>;
30
+ execute: () => Promise<{
41
31
  error: string;
42
32
  comments?: undefined;
43
33
  approved?: undefined;
@@ -1,18 +1,22 @@
1
1
  import { z } from 'zod';
2
2
  import { PlanService } from '../services/planService.js';
3
3
  import { FeatureService } from '../services/featureService.js';
4
+ import { detectContext } from '../utils/detection.js';
4
5
  export function createPlanTools(projectRoot) {
5
6
  const planService = new PlanService(projectRoot);
6
7
  const featureService = new FeatureService(projectRoot);
8
+ const getActiveFeature = () => {
9
+ const ctx = detectContext(projectRoot);
10
+ return ctx?.feature || null;
11
+ };
7
12
  return {
8
13
  hive_plan_write: {
9
- description: 'Create or update the plan.md for the active feature. Clears any existing comments (new plan = fresh review).',
14
+ description: 'Write plan.md (clears existing comments)',
10
15
  parameters: z.object({
11
16
  content: z.string().describe('The markdown content for the plan'),
12
- featureName: z.string().optional().describe('Feature name (defaults to active feature)'),
13
17
  }),
14
- execute: async ({ content, featureName }) => {
15
- const feature = featureName || featureService.getActive();
18
+ execute: async ({ content }) => {
19
+ const feature = getActiveFeature();
16
20
  if (!feature) {
17
21
  return { error: 'No active feature. Create one with hive_feature_create first.' };
18
22
  }
@@ -21,12 +25,10 @@ export function createPlanTools(projectRoot) {
21
25
  },
22
26
  },
23
27
  hive_plan_read: {
24
- description: 'Read the plan.md and any user comments for the active feature.',
25
- parameters: z.object({
26
- featureName: z.string().optional().describe('Feature name (defaults to active feature)'),
27
- }),
28
- execute: async ({ featureName }) => {
29
- const feature = featureName || featureService.getActive();
28
+ description: 'Read plan.md and user comments',
29
+ parameters: z.object({}),
30
+ execute: async () => {
31
+ const feature = getActiveFeature();
30
32
  if (!feature) {
31
33
  return { error: 'No active feature.' };
32
34
  }
@@ -38,12 +40,10 @@ export function createPlanTools(projectRoot) {
38
40
  },
39
41
  },
40
42
  hive_plan_approve: {
41
- description: 'Approve the plan for execution. After approval, run hive_tasks_sync to generate tasks.',
42
- parameters: z.object({
43
- featureName: z.string().optional().describe('Feature name (defaults to active feature)'),
44
- }),
45
- execute: async ({ featureName }) => {
46
- const feature = featureName || featureService.getActive();
43
+ description: 'Approve plan for execution',
44
+ parameters: z.object({}),
45
+ execute: async () => {
46
+ const feature = getActiveFeature();
47
47
  if (!feature) {
48
48
  return { error: 'No active feature.' };
49
49
  }
@@ -0,0 +1,35 @@
1
+ import { z } from 'zod';
2
+ export declare function createSessionTools(projectRoot: string): {
3
+ hive_session_open: {
4
+ description: string;
5
+ parameters: z.ZodObject<{
6
+ feature: z.ZodOptional<z.ZodString>;
7
+ task: z.ZodOptional<z.ZodString>;
8
+ }, z.core.$strip>;
9
+ execute: ({ feature, task }: {
10
+ feature?: string;
11
+ task?: string;
12
+ }, toolContext: unknown) => Promise<Record<string, unknown>>;
13
+ };
14
+ hive_session_list: {
15
+ description: string;
16
+ parameters: z.ZodObject<{}, z.core.$strip>;
17
+ execute: () => Promise<{
18
+ error: string;
19
+ feature?: undefined;
20
+ master?: undefined;
21
+ sessions?: undefined;
22
+ } | {
23
+ feature: string;
24
+ master: string | undefined;
25
+ sessions: {
26
+ sessionId: string;
27
+ taskFolder: string | undefined;
28
+ startedAt: string;
29
+ lastActiveAt: string;
30
+ isMaster: boolean;
31
+ }[];
32
+ error?: undefined;
33
+ }>;
34
+ };
35
+ };
@@ -0,0 +1,95 @@
1
+ import { z } from 'zod';
2
+ import { SessionService } from '../services/sessionService.js';
3
+ import { FeatureService } from '../services/featureService.js';
4
+ import { TaskService } from '../services/taskService.js';
5
+ import { PlanService } from '../services/planService.js';
6
+ import { ContextService } from '../services/contextService.js';
7
+ import { detectContext } from '../utils/detection.js';
8
+ export function createSessionTools(projectRoot) {
9
+ const sessionService = new SessionService(projectRoot);
10
+ const featureService = new FeatureService(projectRoot);
11
+ const taskService = new TaskService(projectRoot);
12
+ const planService = new PlanService(projectRoot);
13
+ const contextService = new ContextService(projectRoot);
14
+ const getActiveFeature = () => {
15
+ const ctx = detectContext(projectRoot);
16
+ return ctx?.feature || null;
17
+ };
18
+ return {
19
+ hive_session_open: {
20
+ description: 'Open a Hive session for a feature or task. Returns full context needed to resume work.',
21
+ parameters: z.object({
22
+ feature: z.string().optional().describe('Feature name (defaults to active)'),
23
+ task: z.string().optional().describe('Task folder to focus on'),
24
+ }),
25
+ execute: async ({ feature, task }, toolContext) => {
26
+ const featureName = feature || getActiveFeature();
27
+ if (!featureName)
28
+ return { error: 'No feature specified and no active feature' };
29
+ const featureData = featureService.get(featureName);
30
+ if (!featureData)
31
+ return { error: `Feature '${featureName}' not found` };
32
+ const ctx = toolContext;
33
+ if (ctx?.sessionID) {
34
+ sessionService.track(featureName, ctx.sessionID, task);
35
+ }
36
+ const planResult = planService.read(featureName);
37
+ const tasks = taskService.list(featureName);
38
+ const contextCompiled = contextService.compile(featureName);
39
+ const sessions = sessionService.list(featureName);
40
+ const response = {
41
+ feature: {
42
+ name: featureData.name,
43
+ status: featureData.status,
44
+ ticket: featureData.ticket,
45
+ },
46
+ plan: planResult ? {
47
+ content: planResult.content,
48
+ commentCount: planResult.comments.length,
49
+ } : null,
50
+ tasks: tasks.map(t => ({
51
+ folder: t.folder,
52
+ name: t.name,
53
+ status: t.status,
54
+ origin: t.origin,
55
+ })),
56
+ context: contextCompiled || null,
57
+ sessions: sessions.map(s => ({
58
+ sessionId: s.sessionId,
59
+ taskFolder: s.taskFolder,
60
+ isMaster: s.sessionId === sessionService.getMaster(featureName),
61
+ })),
62
+ };
63
+ if (task) {
64
+ const taskInfo = taskService.get(featureName, task);
65
+ if (taskInfo) {
66
+ response.focusedTask = taskInfo;
67
+ }
68
+ }
69
+ return response;
70
+ },
71
+ },
72
+ hive_session_list: {
73
+ description: 'List all sessions for the active feature',
74
+ parameters: z.object({}),
75
+ execute: async () => {
76
+ const feature = getActiveFeature();
77
+ if (!feature)
78
+ return { error: 'No active feature' };
79
+ const sessions = sessionService.list(feature);
80
+ const master = sessionService.getMaster(feature);
81
+ return {
82
+ feature,
83
+ master,
84
+ sessions: sessions.map(s => ({
85
+ sessionId: s.sessionId,
86
+ taskFolder: s.taskFolder,
87
+ startedAt: s.startedAt,
88
+ lastActiveAt: s.lastActiveAt,
89
+ isMaster: s.sessionId === master,
90
+ })),
91
+ };
92
+ },
93
+ },
94
+ };
95
+ }
@@ -2,12 +2,8 @@ import { z } from 'zod';
2
2
  export declare function createTaskTools(projectRoot: string): {
3
3
  hive_tasks_sync: {
4
4
  description: string;
5
- parameters: z.ZodObject<{
6
- featureName: z.ZodOptional<z.ZodString>;
7
- }, z.core.$strip>;
8
- execute: ({ featureName }: {
9
- featureName?: string;
10
- }) => Promise<{
5
+ parameters: z.ZodObject<{}, z.core.$strip>;
6
+ execute: () => Promise<{
11
7
  error: string;
12
8
  } | {
13
9
  message: string;
@@ -23,12 +19,10 @@ export declare function createTaskTools(projectRoot: string): {
23
19
  parameters: z.ZodObject<{
24
20
  name: z.ZodString;
25
21
  order: z.ZodOptional<z.ZodNumber>;
26
- featureName: z.ZodOptional<z.ZodString>;
27
22
  }, z.core.$strip>;
28
- execute: ({ name, order, featureName }: {
23
+ execute: ({ name, order }: {
29
24
  name: string;
30
25
  order?: number;
31
- featureName?: string;
32
26
  }) => Promise<{
33
27
  error: string;
34
28
  folder?: undefined;
@@ -52,13 +46,11 @@ export declare function createTaskTools(projectRoot: string): {
52
46
  cancelled: "cancelled";
53
47
  }>>;
54
48
  summary: z.ZodOptional<z.ZodString>;
55
- featureName: z.ZodOptional<z.ZodString>;
56
49
  }, z.core.$strip>;
57
- execute: ({ task, status, summary, featureName }: {
50
+ execute: ({ task, status, summary }: {
58
51
  task: string;
59
52
  status?: "pending" | "in_progress" | "done" | "cancelled";
60
53
  summary?: string;
61
- featureName?: string;
62
54
  }) => Promise<{
63
55
  error: string;
64
56
  updated?: undefined;
@@ -75,12 +67,8 @@ export declare function createTaskTools(projectRoot: string): {
75
67
  };
76
68
  hive_task_list: {
77
69
  description: string;
78
- parameters: z.ZodObject<{
79
- featureName: z.ZodOptional<z.ZodString>;
80
- }, z.core.$strip>;
81
- execute: ({ featureName }: {
82
- featureName?: string;
83
- }) => Promise<{
70
+ parameters: z.ZodObject<{}, z.core.$strip>;
71
+ execute: () => Promise<{
84
72
  error: string;
85
73
  tasks?: undefined;
86
74
  } | {
@@ -1,17 +1,20 @@
1
1
  import { z } from 'zod';
2
2
  import { TaskService } from '../services/taskService.js';
3
3
  import { FeatureService } from '../services/featureService.js';
4
+ import { detectContext } from '../utils/detection.js';
4
5
  export function createTaskTools(projectRoot) {
5
6
  const taskService = new TaskService(projectRoot);
6
7
  const featureService = new FeatureService(projectRoot);
8
+ const getActiveFeature = () => {
9
+ const ctx = detectContext(projectRoot);
10
+ return ctx?.feature || null;
11
+ };
7
12
  return {
8
13
  hive_tasks_sync: {
9
- description: 'Parse the approved plan.md and sync task folders. Creates new tasks, removes obsolete pending tasks, keeps completed/in-progress tasks.',
10
- parameters: z.object({
11
- featureName: z.string().optional().describe('Feature name (defaults to active feature)'),
12
- }),
13
- execute: async ({ featureName }) => {
14
- const feature = featureName || featureService.getActive();
14
+ description: 'Generate tasks from approved plan',
15
+ parameters: z.object({}),
16
+ execute: async () => {
17
+ const feature = getActiveFeature();
15
18
  if (!feature) {
16
19
  return { error: 'No active feature.' };
17
20
  }
@@ -33,14 +36,13 @@ export function createTaskTools(projectRoot) {
33
36
  },
34
37
  },
35
38
  hive_task_create: {
36
- description: 'Create a manual task (not from plan). Use for hotfixes or ad-hoc work during execution.',
39
+ description: 'Create manual task (not from plan)',
37
40
  parameters: z.object({
38
41
  name: z.string().describe('Task name (will be slugified)'),
39
42
  order: z.number().optional().describe('Task order number (defaults to next available)'),
40
- featureName: z.string().optional().describe('Feature name (defaults to active feature)'),
41
43
  }),
42
- execute: async ({ name, order, featureName }) => {
43
- const feature = featureName || featureService.getActive();
44
+ execute: async ({ name, order }) => {
45
+ const feature = getActiveFeature();
44
46
  if (!feature) {
45
47
  return { error: 'No active feature.' };
46
48
  }
@@ -53,15 +55,14 @@ export function createTaskTools(projectRoot) {
53
55
  },
54
56
  },
55
57
  hive_task_update: {
56
- description: 'Update a task status or summary.',
58
+ description: 'Update task status or summary',
57
59
  parameters: z.object({
58
60
  task: z.string().describe('Task folder name (e.g., "01-auth-service")'),
59
61
  status: z.enum(['pending', 'in_progress', 'done', 'cancelled']).optional(),
60
62
  summary: z.string().optional().describe('Summary of work done'),
61
- featureName: z.string().optional().describe('Feature name (defaults to active feature)'),
62
63
  }),
63
- execute: async ({ task, status, summary, featureName }) => {
64
- const feature = featureName || featureService.getActive();
64
+ execute: async ({ task, status, summary }) => {
65
+ const feature = getActiveFeature();
65
66
  if (!feature) {
66
67
  return { error: 'No active feature.' };
67
68
  }
@@ -71,11 +72,9 @@ export function createTaskTools(projectRoot) {
71
72
  },
72
73
  hive_task_list: {
73
74
  description: 'List all tasks for the active feature.',
74
- parameters: z.object({
75
- featureName: z.string().optional().describe('Feature name (defaults to active feature)'),
76
- }),
77
- execute: async ({ featureName }) => {
78
- const feature = featureName || featureService.getActive();
75
+ parameters: z.object({}),
76
+ execute: async () => {
77
+ const feature = getActiveFeature();
79
78
  if (!feature) {
80
79
  return { error: 'No active feature.' };
81
80
  }
package/dist/types.d.ts CHANGED
@@ -16,6 +16,7 @@ export interface TaskStatus {
16
16
  summary?: string;
17
17
  startedAt?: string;
18
18
  completedAt?: string;
19
+ baseCommit?: string;
19
20
  }
20
21
  export interface PlanComment {
21
22
  id: string;
@@ -52,3 +53,37 @@ export interface FeatureInfo {
52
53
  hasPlan: boolean;
53
54
  commentCount: number;
54
55
  }
56
+ export interface ContextFile {
57
+ name: string;
58
+ content: string;
59
+ updatedAt: string;
60
+ }
61
+ export interface SessionInfo {
62
+ sessionId: string;
63
+ taskFolder?: string;
64
+ startedAt: string;
65
+ lastActiveAt: string;
66
+ messageCount?: number;
67
+ }
68
+ export interface SessionsJson {
69
+ master?: string;
70
+ sessions: SessionInfo[];
71
+ }
72
+ export interface TaskSpec {
73
+ taskFolder: string;
74
+ featureName: string;
75
+ planSection: string;
76
+ context: string;
77
+ priorTasks: Array<{
78
+ folder: string;
79
+ summary?: string;
80
+ }>;
81
+ }
82
+ export interface HiveConfig {
83
+ enableToolsFor: string[];
84
+ agents: {
85
+ worker: {
86
+ visible: boolean;
87
+ };
88
+ };
89
+ }
@@ -0,0 +1,12 @@
1
+ import { FeatureJson } from '../types.js';
2
+ export interface DetectionResult {
3
+ projectRoot: string;
4
+ feature: string | null;
5
+ task: string | null;
6
+ isWorktree: boolean;
7
+ mainProjectRoot: string | null;
8
+ }
9
+ export declare function detectContext(cwd: string): DetectionResult;
10
+ export declare function listFeatures(projectRoot: string): string[];
11
+ export declare function getFeatureData(projectRoot: string, featureName: string): FeatureJson | null;
12
+ export declare function findProjectRoot(startDir: string): string | null;