orbitmap 0.3.0 → 0.4.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.
- package/README.md +546 -212
- package/dist/adapters/cloud.d.ts +367 -0
- package/dist/adapters/cloud.js +582 -0
- package/dist/adapters/cloud.js.map +1 -0
- package/dist/adapters/factory.d.ts +15 -0
- package/dist/adapters/factory.js +31 -0
- package/dist/adapters/factory.js.map +1 -0
- package/dist/adapters/local/adapter.d.ts +351 -0
- package/dist/adapters/local/adapter.js +346 -0
- package/dist/adapters/local/adapter.js.map +1 -0
- package/dist/adapters/local/context.d.ts +112 -0
- package/dist/adapters/local/context.js +137 -0
- package/dist/adapters/local/context.js.map +1 -0
- package/dist/adapters/local/entities/documents.d.ts +85 -0
- package/dist/adapters/local/entities/documents.js +251 -0
- package/dist/adapters/local/entities/documents.js.map +1 -0
- package/dist/adapters/local/entities/planning.d.ts +108 -0
- package/dist/adapters/local/entities/planning.js +540 -0
- package/dist/adapters/local/entities/planning.js.map +1 -0
- package/dist/adapters/local/entities/tasks.d.ts +95 -0
- package/dist/adapters/local/entities/tasks.js +442 -0
- package/dist/adapters/local/entities/tasks.js.map +1 -0
- package/dist/adapters/local/entities/work-items.d.ts +110 -0
- package/dist/adapters/local/entities/work-items.js +623 -0
- package/dist/adapters/local/entities/work-items.js.map +1 -0
- package/dist/adapters/local/rules.d.ts +172 -0
- package/dist/adapters/local/rules.js +319 -0
- package/dist/adapters/local/rules.js.map +1 -0
- package/dist/adapters/local/shapes.d.ts +209 -0
- package/dist/adapters/local/shapes.js +558 -0
- package/dist/adapters/local/shapes.js.map +1 -0
- package/dist/adapters/local/store.d.ts +200 -0
- package/dist/adapters/local/store.js +665 -0
- package/dist/adapters/local/store.js.map +1 -0
- package/dist/adapters/local/types.d.ts +226 -0
- package/dist/adapters/local/types.js +41 -0
- package/dist/adapters/local/types.js.map +1 -0
- package/dist/adapters/types.d.ts +332 -0
- package/dist/adapters/types.js +2 -0
- package/dist/adapters/types.js.map +1 -0
- package/dist/agent-instructions.d.ts +25 -9
- package/dist/agent-instructions.js +285 -237
- package/dist/agent-instructions.js.map +1 -1
- package/dist/api-client.d.ts +8 -239
- package/dist/api-client.js +8 -403
- package/dist/api-client.js.map +1 -1
- package/dist/commands/agents.d.ts +1 -1
- package/dist/commands/agents.js +10 -10
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/areas.d.ts +3 -0
- package/dist/commands/areas.js +29 -0
- package/dist/commands/areas.js.map +1 -0
- package/dist/commands/assign.d.ts +3 -2
- package/dist/commands/assign.js +52 -15
- package/dist/commands/assign.js.map +1 -1
- package/dist/commands/context.d.ts +1 -1
- package/dist/commands/context.js +18 -12
- package/dist/commands/context.js.map +1 -1
- package/dist/commands/create-area.d.ts +7 -0
- package/dist/commands/create-area.js +29 -0
- package/dist/commands/create-area.js.map +1 -0
- package/dist/commands/create.d.ts +3 -1
- package/dist/commands/create.js +5 -8
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/dep.d.ts +2 -2
- package/dist/commands/dep.js +3 -3
- package/dist/commands/dep.js.map +1 -1
- package/dist/commands/doc-import.d.ts +1 -1
- package/dist/commands/doc-import.js +2 -2
- package/dist/commands/doc-import.js.map +1 -1
- package/dist/commands/doc-patch.d.ts +1 -1
- package/dist/commands/doc-patch.js +2 -2
- package/dist/commands/doc-patch.js.map +1 -1
- package/dist/commands/doc-share.d.ts +6 -6
- package/dist/commands/doc-share.js +13 -13
- package/dist/commands/doc-share.js.map +1 -1
- package/dist/commands/doc-update.d.ts +1 -1
- package/dist/commands/doc-update.js +2 -2
- package/dist/commands/doc-update.js.map +1 -1
- package/dist/commands/doc.d.ts +1 -1
- package/dist/commands/doc.js +5 -4
- package/dist/commands/doc.js.map +1 -1
- package/dist/commands/docs-cache.d.ts +2 -2
- package/dist/commands/docs-cache.js +3 -3
- package/dist/commands/docs-cache.js.map +1 -1
- package/dist/commands/docs.d.ts +1 -1
- package/dist/commands/docs.js +2 -2
- package/dist/commands/docs.js.map +1 -1
- package/dist/commands/get.d.ts +1 -1
- package/dist/commands/get.js +43 -3
- package/dist/commands/get.js.map +1 -1
- package/dist/commands/ideas.d.ts +4 -4
- package/dist/commands/ideas.js +6 -11
- package/dist/commands/ideas.js.map +1 -1
- package/dist/commands/init.d.ts +45 -3
- package/dist/commands/init.js +452 -104
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/intent.d.ts +41 -0
- package/dist/commands/intent.js +237 -0
- package/dist/commands/intent.js.map +1 -0
- package/dist/commands/issues.d.ts +6 -5
- package/dist/commands/issues.js +8 -12
- package/dist/commands/issues.js.map +1 -1
- package/dist/commands/log.d.ts +1 -1
- package/dist/commands/log.js +2 -2
- package/dist/commands/log.js.map +1 -1
- package/dist/commands/mission.d.ts +42 -0
- package/dist/commands/mission.js +219 -0
- package/dist/commands/mission.js.map +1 -0
- package/dist/commands/orbit.d.ts +40 -3
- package/dist/commands/orbit.js +231 -58
- package/dist/commands/orbit.js.map +1 -1
- package/dist/commands/overview.d.ts +2 -2
- package/dist/commands/overview.js +25 -28
- package/dist/commands/overview.js.map +1 -1
- package/dist/commands/setup-agent.d.ts +27 -0
- package/dist/commands/setup-agent.js +85 -30
- package/dist/commands/setup-agent.js.map +1 -1
- package/dist/commands/setup-mcp.d.ts +1 -1
- package/dist/commands/setup-mcp.js +20 -49
- package/dist/commands/setup-mcp.js.map +1 -1
- package/dist/commands/start.d.ts +1 -1
- package/dist/commands/start.js +2 -2
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/status.d.ts +2 -1
- package/dist/commands/status.js +3 -3
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/subtask.d.ts +1 -1
- package/dist/commands/subtask.js +2 -2
- package/dist/commands/subtask.js.map +1 -1
- package/dist/commands/task-edit-content.d.ts +1 -1
- package/dist/commands/task-edit-content.js +2 -2
- package/dist/commands/task-edit-content.js.map +1 -1
- package/dist/commands/task.d.ts +10 -3
- package/dist/commands/task.js +19 -21
- package/dist/commands/task.js.map +1 -1
- package/dist/commands/tasks.d.ts +1 -1
- package/dist/commands/tasks.js +2 -2
- package/dist/commands/tasks.js.map +1 -1
- package/dist/commands/vibes.d.ts +4 -4
- package/dist/commands/vibes.js +5 -5
- package/dist/commands/vibes.js.map +1 -1
- package/dist/config.d.ts +69 -9
- package/dist/config.js +206 -23
- package/dist/config.js.map +1 -1
- package/dist/doc-cache.d.ts +23 -3
- package/dist/doc-cache.js +72 -12
- package/dist/doc-cache.js.map +1 -1
- package/dist/errors.d.ts +19 -2
- package/dist/errors.js +35 -0
- package/dist/errors.js.map +1 -1
- package/dist/id-resolve.d.ts +61 -0
- package/dist/id-resolve.js +87 -0
- package/dist/id-resolve.js.map +1 -0
- package/dist/index.js +477 -104
- package/dist/index.js.map +1 -1
- package/dist/mcp-config.d.ts +36 -0
- package/dist/mcp-config.js +51 -0
- package/dist/mcp-config.js.map +1 -0
- package/dist/oauth.d.ts +8 -0
- package/dist/oauth.js +54 -15
- package/dist/oauth.js.map +1 -1
- package/dist/output.js +7 -2
- package/dist/output.js.map +1 -1
- package/dist/paths.d.ts +97 -0
- package/dist/paths.js +178 -0
- package/dist/paths.js.map +1 -0
- package/dist/project-config.d.ts +75 -0
- package/dist/project-config.js +55 -0
- package/dist/project-config.js.map +1 -0
- package/dist/workspace-resolve.d.ts +158 -0
- package/dist/workspace-resolve.js +284 -0
- package/dist/workspace-resolve.js.map +1 -0
- package/package.json +53 -50
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local-mode domain rules — the code equivalent of the server's DB triggers and
|
|
3
|
+
* service-layer validation (spec §6).
|
|
4
|
+
*
|
|
5
|
+
* Everything here is a PURE FUNCTION over plain records: no file I/O, no imports from
|
|
6
|
+
* `store.ts`, no network. The LocalAdapter reads the records it needs from the store and
|
|
7
|
+
* hands them to these helpers. Every violation throws `OrbitMapAPIError` with code
|
|
8
|
+
* `VALIDATION_ERROR` and a message that names the violated rule.
|
|
9
|
+
*
|
|
10
|
+
* The `*Like` interfaces below are deliberately minimal/structural so that the concrete
|
|
11
|
+
* record types in `types.ts` satisfy them without this module depending on them.
|
|
12
|
+
*/
|
|
13
|
+
import { OrbitMapAPIError } from '../../errors.js';
|
|
14
|
+
/** Error code every rule violation carries (matches the API's validation envelope). */
|
|
15
|
+
export declare const VALIDATION_ERROR = "VALIDATION_ERROR";
|
|
16
|
+
/** Build the standard rule-violation error. `rule` is named in the message on purpose. */
|
|
17
|
+
export declare function validationError(rule: string, message: string, details?: Record<string, unknown>): OrbitMapAPIError;
|
|
18
|
+
/** §4.5 tasks.status */
|
|
19
|
+
export declare const TASK_STATUSES: readonly ["backlog", "todo", "in_progress", "in_review", "review_changes", "done", "blocked"];
|
|
20
|
+
export type TaskStatus = (typeof TASK_STATUSES)[number];
|
|
21
|
+
/** §4.5 tasks.priority (also ideas.priority) */
|
|
22
|
+
export declare const PRIORITIES: readonly ["critical", "high", "medium", "low"];
|
|
23
|
+
export type Priority = (typeof PRIORITIES)[number];
|
|
24
|
+
/** §4.5 tasks.delivery_status (nullable) */
|
|
25
|
+
export declare const DELIVERY_STATUSES: readonly ["on_branch", "merged", "released"];
|
|
26
|
+
export type DeliveryStatus = (typeof DELIVERY_STATUSES)[number];
|
|
27
|
+
/** §4.5 task_logs.type */
|
|
28
|
+
export declare const TASK_LOG_TYPES: readonly ["note", "code_change", "decision", "blocker"];
|
|
29
|
+
export type TaskLogType = (typeof TASK_LOG_TYPES)[number];
|
|
30
|
+
/** §4.6 issues.status */
|
|
31
|
+
export declare const ISSUE_STATUSES: readonly ["open", "backlog", "investigating", "resolved", "wont_fix", "duplicate"];
|
|
32
|
+
export type IssueStatus = (typeof ISSUE_STATUSES)[number];
|
|
33
|
+
/** §4.6 issues.severity */
|
|
34
|
+
export declare const ISSUE_SEVERITIES: readonly ["critical", "high", "medium", "low"];
|
|
35
|
+
export type IssueSeverity = (typeof ISSUE_SEVERITIES)[number];
|
|
36
|
+
/** §4.7 ideas.status */
|
|
37
|
+
export declare const IDEA_STATUSES: readonly ["pending", "accepted", "used", "rejected"];
|
|
38
|
+
export type IdeaStatus = (typeof IDEA_STATUSES)[number];
|
|
39
|
+
/** §4.8 vibes.type */
|
|
40
|
+
export declare const VIBE_TYPES: readonly ["note", "code_change", "decision", "discovery", "idea", "exploration", "fix"];
|
|
41
|
+
export type VibeType = (typeof VIBE_TYPES)[number];
|
|
42
|
+
/** §4.9 missions.status */
|
|
43
|
+
export declare const MISSION_STATUSES: readonly ["new", "active", "completed", "cancelled"];
|
|
44
|
+
export type MissionStatus = (typeof MISSION_STATUSES)[number];
|
|
45
|
+
/** §4.10 intents.status */
|
|
46
|
+
export declare const INTENT_STATUSES: readonly ["new", "design", "plan", "build", "done", "cancelled"];
|
|
47
|
+
export type IntentStatus = (typeof INTENT_STATUSES)[number];
|
|
48
|
+
/** §4.11 documents.type */
|
|
49
|
+
export declare const DOCUMENT_TYPES: readonly ["spec", "architecture", "api", "guide", "decision", "changelog", "other"];
|
|
50
|
+
export type DocumentType = (typeof DOCUMENT_TYPES)[number];
|
|
51
|
+
/** §4.11 documents.status */
|
|
52
|
+
export declare const DOCUMENT_STATUSES: readonly ["draft", "published", "archived"];
|
|
53
|
+
export type DocumentStatus = (typeof DOCUMENT_STATUSES)[number];
|
|
54
|
+
export interface EnumOptions {
|
|
55
|
+
/** Accept `null`/`undefined` and return `null` instead of throwing. */
|
|
56
|
+
nullable?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Rule 1 — assert `value` is one of `allowed`.
|
|
60
|
+
* Returns the narrowed value (or `null` when nullable and empty).
|
|
61
|
+
*/
|
|
62
|
+
export declare function assertEnum<T extends string>(field: string, value: unknown, allowed: readonly T[], options?: EnumOptions): T | null;
|
|
63
|
+
export declare const assertTaskStatus: (value: unknown) => TaskStatus;
|
|
64
|
+
export declare const assertPriority: (value: unknown) => Priority;
|
|
65
|
+
export declare const assertDeliveryStatus: (value: unknown) => DeliveryStatus | null;
|
|
66
|
+
export declare const assertTaskLogType: (value: unknown) => TaskLogType;
|
|
67
|
+
export declare const assertIssueStatus: (value: unknown) => IssueStatus;
|
|
68
|
+
export declare const assertIssueSeverity: (value: unknown) => IssueSeverity;
|
|
69
|
+
export declare const assertIdeaStatus: (value: unknown) => IdeaStatus;
|
|
70
|
+
export declare const assertVibeType: (value: unknown) => VibeType;
|
|
71
|
+
export declare const assertMissionStatus: (value: unknown) => MissionStatus;
|
|
72
|
+
export declare const assertIntentStatus: (value: unknown) => IntentStatus;
|
|
73
|
+
export declare const assertDocumentType: (value: unknown) => DocumentType;
|
|
74
|
+
export declare const assertDocumentStatus: (value: unknown) => DocumentStatus;
|
|
75
|
+
/** Minimal shape of a task record the rules need. */
|
|
76
|
+
export interface TaskLike {
|
|
77
|
+
task_number: string;
|
|
78
|
+
status: string;
|
|
79
|
+
parent_task?: string | null;
|
|
80
|
+
intent?: string | null;
|
|
81
|
+
mission?: string | null;
|
|
82
|
+
assigned_agent?: string | null;
|
|
83
|
+
assigned_user?: string | null;
|
|
84
|
+
sort_order?: number | null;
|
|
85
|
+
created_at?: string | null;
|
|
86
|
+
depends_on?: string[] | null;
|
|
87
|
+
}
|
|
88
|
+
/** Minimal shape of a mission record the rules need. */
|
|
89
|
+
export interface MissionLike {
|
|
90
|
+
mission_number: string;
|
|
91
|
+
status: string;
|
|
92
|
+
}
|
|
93
|
+
/** An item (task or issue) that can carry intent/mission references. */
|
|
94
|
+
export interface LinkableLike {
|
|
95
|
+
intent?: string | null;
|
|
96
|
+
mission?: string | null;
|
|
97
|
+
}
|
|
98
|
+
/** Known entity numbers, used to resolve references (rule 3). */
|
|
99
|
+
export interface ReferenceIndex {
|
|
100
|
+
intents: Iterable<string>;
|
|
101
|
+
missions: Iterable<string>;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Rule 2 — reject moving a parent task to `done` while any of its subtasks is not `done`.
|
|
105
|
+
*
|
|
106
|
+
* @param taskNumber the parent task being transitioned
|
|
107
|
+
* @param nextStatus the requested status
|
|
108
|
+
* @param subtasks the parent's direct subtasks (already filtered by `parent_task`)
|
|
109
|
+
* @param force explicit bypass (`--force`)
|
|
110
|
+
*/
|
|
111
|
+
export declare function assertParentCompletable(taskNumber: string, nextStatus: string, subtasks: readonly TaskLike[], force?: boolean): void;
|
|
112
|
+
/** Rule 3 — the referenced intent must exist in the workspace. */
|
|
113
|
+
export declare function assertIntentReference(ref: string | null | undefined, knownIntents: Iterable<string>): void;
|
|
114
|
+
/** Rule 3 — the referenced mission must exist in the workspace. */
|
|
115
|
+
export declare function assertMissionReference(ref: string | null | undefined, knownMissions: Iterable<string>): void;
|
|
116
|
+
/** Rule 3 — validate both references carried by a task/issue. */
|
|
117
|
+
export declare function assertReferencesResolve(item: LinkableLike, index: ReferenceIndex): void;
|
|
118
|
+
/**
|
|
119
|
+
* Rule 4 — a task/issue may carry a direct `mission` only when `intent` is null;
|
|
120
|
+
* with an intent set, the mission is derived through the intent.
|
|
121
|
+
*/
|
|
122
|
+
export declare function assertIntentExclusiveMission(item: LinkableLike): void;
|
|
123
|
+
/**
|
|
124
|
+
* Rule 4 — link an item to an intent: sets `intent` and clears any direct `mission`.
|
|
125
|
+
* Returns a NEW object; the input is not mutated. Pass `null` to unlink.
|
|
126
|
+
*/
|
|
127
|
+
export declare function applyIntentLink<T extends LinkableLike>(item: T, intentNumber: string | null): T;
|
|
128
|
+
/**
|
|
129
|
+
* Rule 4 — link an item directly to a mission. Rejected when the item already has an
|
|
130
|
+
* intent (the mission must be set on the intent instead).
|
|
131
|
+
*/
|
|
132
|
+
export declare function applyMissionLink<T extends LinkableLike>(item: T, missionNumber: string | null): T;
|
|
133
|
+
/**
|
|
134
|
+
* Rule 5 — activating a mission fails while another mission is `active`.
|
|
135
|
+
*
|
|
136
|
+
* @param missionNumber the mission being transitioned
|
|
137
|
+
* @param nextStatus the requested status
|
|
138
|
+
* @param missions every mission in the workspace (the target may be included)
|
|
139
|
+
*/
|
|
140
|
+
export declare function assertSingleActiveMission(missionNumber: string, nextStatus: string, missions: readonly MissionLike[]): void;
|
|
141
|
+
/** Rule 6 — area slugs are unique within a workspace. */
|
|
142
|
+
export declare function assertUniqueAreaSlug(slug: string, existing: Iterable<string>): void;
|
|
143
|
+
/** Rule 6 — document slugs are unique within a workspace. */
|
|
144
|
+
export declare function assertUniqueDocumentSlug(slug: string, existing: Iterable<string>): void;
|
|
145
|
+
/** Adjacency list: task number → the task numbers it depends on. */
|
|
146
|
+
export type DependencyGraph = ReadonlyMap<string, readonly string[]>;
|
|
147
|
+
/** Build a dependency graph from task records (edge: task → each of its `depends_on`). */
|
|
148
|
+
export declare function buildDependencyGraph(tasks: readonly TaskLike[]): Map<string, string[]>;
|
|
149
|
+
/**
|
|
150
|
+
* Rule 7 — reject a `depends_on` edge that would create a cycle.
|
|
151
|
+
*
|
|
152
|
+
* @param dependent the task that would depend on `dependency` (edge source)
|
|
153
|
+
* @param dependency the task depended upon (edge target)
|
|
154
|
+
* @param graph the current dependency graph (edge not yet added)
|
|
155
|
+
*/
|
|
156
|
+
export declare function assertNoDependencyCycle(dependent: string, dependency: string, graph: DependencyGraph): void;
|
|
157
|
+
export interface SelectNextTaskOptions {
|
|
158
|
+
/** Identity of the local agent; tasks assigned to anyone else are skipped. */
|
|
159
|
+
agent?: string | null;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Rule 8 — pick the task `orbitmap start` (no id) should begin: the first `todo` task of
|
|
163
|
+
* the area, ordered by `sort_order` then `created_at`, restricted to tasks assigned to the
|
|
164
|
+
* local agent or unassigned. Pure selection — the caller performs the status write.
|
|
165
|
+
*
|
|
166
|
+
* @param tasks candidate tasks of the current area
|
|
167
|
+
* @param options `agent` = the local agent identity (default `local-agent`)
|
|
168
|
+
* @returns the selected task, or `null` when nothing is startable
|
|
169
|
+
*/
|
|
170
|
+
export declare function selectNextTask(tasks: readonly TaskLike[], options?: SelectNextTaskOptions): TaskLike | null;
|
|
171
|
+
/** Ordering used by `selectNextTask`: sort_order ascending, then created_at ascending. */
|
|
172
|
+
export declare function compareStartOrder(a: TaskLike, b: TaskLike): number;
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local-mode domain rules — the code equivalent of the server's DB triggers and
|
|
3
|
+
* service-layer validation (spec §6).
|
|
4
|
+
*
|
|
5
|
+
* Everything here is a PURE FUNCTION over plain records: no file I/O, no imports from
|
|
6
|
+
* `store.ts`, no network. The LocalAdapter reads the records it needs from the store and
|
|
7
|
+
* hands them to these helpers. Every violation throws `OrbitMapAPIError` with code
|
|
8
|
+
* `VALIDATION_ERROR` and a message that names the violated rule.
|
|
9
|
+
*
|
|
10
|
+
* The `*Like` interfaces below are deliberately minimal/structural so that the concrete
|
|
11
|
+
* record types in `types.ts` satisfy them without this module depending on them.
|
|
12
|
+
*/
|
|
13
|
+
import { OrbitMapAPIError } from '../../errors.js';
|
|
14
|
+
/** Error code every rule violation carries (matches the API's validation envelope). */
|
|
15
|
+
export const VALIDATION_ERROR = 'VALIDATION_ERROR';
|
|
16
|
+
/** HTTP status the API uses for validation failures. */
|
|
17
|
+
const VALIDATION_STATUS = 422;
|
|
18
|
+
/** Build the standard rule-violation error. `rule` is named in the message on purpose. */
|
|
19
|
+
export function validationError(rule, message, details) {
|
|
20
|
+
return new OrbitMapAPIError(`${rule}: ${message}`, VALIDATION_ERROR, VALIDATION_STATUS, details);
|
|
21
|
+
}
|
|
22
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
23
|
+
// Rule 1 — enum validation (values exactly as spec §4)
|
|
24
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
25
|
+
/** §4.5 tasks.status */
|
|
26
|
+
export const TASK_STATUSES = [
|
|
27
|
+
'backlog',
|
|
28
|
+
'todo',
|
|
29
|
+
'in_progress',
|
|
30
|
+
'in_review',
|
|
31
|
+
'review_changes',
|
|
32
|
+
'done',
|
|
33
|
+
'blocked',
|
|
34
|
+
];
|
|
35
|
+
/** §4.5 tasks.priority (also ideas.priority) */
|
|
36
|
+
export const PRIORITIES = ['critical', 'high', 'medium', 'low'];
|
|
37
|
+
/** §4.5 tasks.delivery_status (nullable) */
|
|
38
|
+
export const DELIVERY_STATUSES = ['on_branch', 'merged', 'released'];
|
|
39
|
+
/** §4.5 task_logs.type */
|
|
40
|
+
export const TASK_LOG_TYPES = ['note', 'code_change', 'decision', 'blocker'];
|
|
41
|
+
/** §4.6 issues.status */
|
|
42
|
+
export const ISSUE_STATUSES = [
|
|
43
|
+
'open',
|
|
44
|
+
'backlog',
|
|
45
|
+
'investigating',
|
|
46
|
+
'resolved',
|
|
47
|
+
'wont_fix',
|
|
48
|
+
'duplicate',
|
|
49
|
+
];
|
|
50
|
+
/** §4.6 issues.severity */
|
|
51
|
+
export const ISSUE_SEVERITIES = ['critical', 'high', 'medium', 'low'];
|
|
52
|
+
/** §4.7 ideas.status */
|
|
53
|
+
export const IDEA_STATUSES = ['pending', 'accepted', 'used', 'rejected'];
|
|
54
|
+
/** §4.8 vibes.type */
|
|
55
|
+
export const VIBE_TYPES = [
|
|
56
|
+
'note',
|
|
57
|
+
'code_change',
|
|
58
|
+
'decision',
|
|
59
|
+
'discovery',
|
|
60
|
+
'idea',
|
|
61
|
+
'exploration',
|
|
62
|
+
'fix',
|
|
63
|
+
];
|
|
64
|
+
/** §4.9 missions.status */
|
|
65
|
+
export const MISSION_STATUSES = ['new', 'active', 'completed', 'cancelled'];
|
|
66
|
+
/** §4.10 intents.status */
|
|
67
|
+
export const INTENT_STATUSES = [
|
|
68
|
+
'new',
|
|
69
|
+
'design',
|
|
70
|
+
'plan',
|
|
71
|
+
'build',
|
|
72
|
+
'done',
|
|
73
|
+
'cancelled',
|
|
74
|
+
];
|
|
75
|
+
/** §4.11 documents.type */
|
|
76
|
+
export const DOCUMENT_TYPES = [
|
|
77
|
+
'spec',
|
|
78
|
+
'architecture',
|
|
79
|
+
'api',
|
|
80
|
+
'guide',
|
|
81
|
+
'decision',
|
|
82
|
+
'changelog',
|
|
83
|
+
'other',
|
|
84
|
+
];
|
|
85
|
+
/** §4.11 documents.status */
|
|
86
|
+
export const DOCUMENT_STATUSES = ['draft', 'published', 'archived'];
|
|
87
|
+
/**
|
|
88
|
+
* Rule 1 — assert `value` is one of `allowed`.
|
|
89
|
+
* Returns the narrowed value (or `null` when nullable and empty).
|
|
90
|
+
*/
|
|
91
|
+
export function assertEnum(field, value, allowed, options = {}) {
|
|
92
|
+
if (value === null || value === undefined || value === '') {
|
|
93
|
+
if (options.nullable)
|
|
94
|
+
return null;
|
|
95
|
+
throw validationError('Enum validation', `${field} is required and must be one of: ${allowed.join(', ')}.`, { field, allowed: [...allowed] });
|
|
96
|
+
}
|
|
97
|
+
if (typeof value !== 'string' || !allowed.includes(value)) {
|
|
98
|
+
throw validationError('Enum validation', `invalid ${field} "${String(value)}" — must be one of: ${allowed.join(', ')}.`, { field, value, allowed: [...allowed] });
|
|
99
|
+
}
|
|
100
|
+
return value;
|
|
101
|
+
}
|
|
102
|
+
export const assertTaskStatus = (value) => assertEnum('task status', value, TASK_STATUSES);
|
|
103
|
+
export const assertPriority = (value) => assertEnum('priority', value, PRIORITIES);
|
|
104
|
+
export const assertDeliveryStatus = (value) => assertEnum('delivery status', value, DELIVERY_STATUSES, { nullable: true });
|
|
105
|
+
export const assertTaskLogType = (value) => assertEnum('log type', value, TASK_LOG_TYPES);
|
|
106
|
+
export const assertIssueStatus = (value) => assertEnum('issue status', value, ISSUE_STATUSES);
|
|
107
|
+
export const assertIssueSeverity = (value) => assertEnum('severity', value, ISSUE_SEVERITIES);
|
|
108
|
+
export const assertIdeaStatus = (value) => assertEnum('idea status', value, IDEA_STATUSES);
|
|
109
|
+
export const assertVibeType = (value) => assertEnum('vibe type', value, VIBE_TYPES);
|
|
110
|
+
export const assertMissionStatus = (value) => assertEnum('mission status', value, MISSION_STATUSES);
|
|
111
|
+
export const assertIntentStatus = (value) => assertEnum('intent status', value, INTENT_STATUSES);
|
|
112
|
+
export const assertDocumentType = (value) => assertEnum('document type', value, DOCUMENT_TYPES);
|
|
113
|
+
export const assertDocumentStatus = (value) => assertEnum('document status', value, DOCUMENT_STATUSES);
|
|
114
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
115
|
+
// Rule 2 — a parent task cannot go to `done` with unfinished subtasks
|
|
116
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
117
|
+
/**
|
|
118
|
+
* Rule 2 — reject moving a parent task to `done` while any of its subtasks is not `done`.
|
|
119
|
+
*
|
|
120
|
+
* @param taskNumber the parent task being transitioned
|
|
121
|
+
* @param nextStatus the requested status
|
|
122
|
+
* @param subtasks the parent's direct subtasks (already filtered by `parent_task`)
|
|
123
|
+
* @param force explicit bypass (`--force`)
|
|
124
|
+
*/
|
|
125
|
+
export function assertParentCompletable(taskNumber, nextStatus, subtasks, force = false) {
|
|
126
|
+
if (nextStatus !== 'done' || force)
|
|
127
|
+
return;
|
|
128
|
+
const open = subtasks.filter((subtask) => subtask.status !== 'done');
|
|
129
|
+
if (open.length === 0)
|
|
130
|
+
return;
|
|
131
|
+
const numbers = open.map((subtask) => subtask.task_number);
|
|
132
|
+
throw validationError('Parent task completion', `${taskNumber} cannot be marked done while ${open.length} subtask(s) are unfinished: ` +
|
|
133
|
+
`${numbers.join(', ')}. Finish them first, or pass --force.`, { task: taskNumber, unfinished_subtasks: numbers });
|
|
134
|
+
}
|
|
135
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
136
|
+
// Rule 3 — reference containment (no dangling IN-…/MS-… refs)
|
|
137
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
138
|
+
function assertReference(ref, prefix, label, known) {
|
|
139
|
+
if (ref === null || ref === undefined || ref === '')
|
|
140
|
+
return;
|
|
141
|
+
if (!ref.startsWith(prefix)) {
|
|
142
|
+
throw validationError('Reference containment', `"${ref}" is not a valid ${label} reference — expected a ${prefix}… number.`, { reference: ref, expected_prefix: prefix });
|
|
143
|
+
}
|
|
144
|
+
for (const candidate of known) {
|
|
145
|
+
if (candidate === ref)
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
throw validationError('Reference containment', `${label} ${ref} does not exist in this workspace.`, { reference: ref });
|
|
149
|
+
}
|
|
150
|
+
/** Rule 3 — the referenced intent must exist in the workspace. */
|
|
151
|
+
export function assertIntentReference(ref, knownIntents) {
|
|
152
|
+
assertReference(ref, 'IN-', 'intent', knownIntents);
|
|
153
|
+
}
|
|
154
|
+
/** Rule 3 — the referenced mission must exist in the workspace. */
|
|
155
|
+
export function assertMissionReference(ref, knownMissions) {
|
|
156
|
+
assertReference(ref, 'MS-', 'mission', knownMissions);
|
|
157
|
+
}
|
|
158
|
+
/** Rule 3 — validate both references carried by a task/issue. */
|
|
159
|
+
export function assertReferencesResolve(item, index) {
|
|
160
|
+
assertIntentReference(item.intent, index.intents);
|
|
161
|
+
assertMissionReference(item.mission, index.missions);
|
|
162
|
+
}
|
|
163
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
164
|
+
// Rule 4 — intent-exclusive mission
|
|
165
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
166
|
+
/**
|
|
167
|
+
* Rule 4 — a task/issue may carry a direct `mission` only when `intent` is null;
|
|
168
|
+
* with an intent set, the mission is derived through the intent.
|
|
169
|
+
*/
|
|
170
|
+
export function assertIntentExclusiveMission(item) {
|
|
171
|
+
const hasIntent = item.intent !== null && item.intent !== undefined && item.intent !== '';
|
|
172
|
+
const hasMission = item.mission !== null && item.mission !== undefined && item.mission !== '';
|
|
173
|
+
if (hasIntent && hasMission) {
|
|
174
|
+
throw validationError('Intent-exclusive mission', `cannot set both intent ${item.intent} and mission ${item.mission} — an item linked ` +
|
|
175
|
+
'to an intent inherits its mission through that intent. Remove the direct mission, ' +
|
|
176
|
+
`or set the mission on ${item.intent} instead.`, { intent: item.intent, mission: item.mission });
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Rule 4 — link an item to an intent: sets `intent` and clears any direct `mission`.
|
|
181
|
+
* Returns a NEW object; the input is not mutated. Pass `null` to unlink.
|
|
182
|
+
*/
|
|
183
|
+
export function applyIntentLink(item, intentNumber) {
|
|
184
|
+
if (intentNumber === null) {
|
|
185
|
+
return { ...item, intent: null };
|
|
186
|
+
}
|
|
187
|
+
return { ...item, intent: intentNumber, mission: null };
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Rule 4 — link an item directly to a mission. Rejected when the item already has an
|
|
191
|
+
* intent (the mission must be set on the intent instead).
|
|
192
|
+
*/
|
|
193
|
+
export function applyMissionLink(item, missionNumber) {
|
|
194
|
+
if (missionNumber === null) {
|
|
195
|
+
return { ...item, mission: null };
|
|
196
|
+
}
|
|
197
|
+
const next = { ...item, mission: missionNumber };
|
|
198
|
+
assertIntentExclusiveMission(next);
|
|
199
|
+
return next;
|
|
200
|
+
}
|
|
201
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
202
|
+
// Rule 5 — at most one active mission
|
|
203
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
204
|
+
/**
|
|
205
|
+
* Rule 5 — activating a mission fails while another mission is `active`.
|
|
206
|
+
*
|
|
207
|
+
* @param missionNumber the mission being transitioned
|
|
208
|
+
* @param nextStatus the requested status
|
|
209
|
+
* @param missions every mission in the workspace (the target may be included)
|
|
210
|
+
*/
|
|
211
|
+
export function assertSingleActiveMission(missionNumber, nextStatus, missions) {
|
|
212
|
+
if (nextStatus !== 'active')
|
|
213
|
+
return;
|
|
214
|
+
const active = missions.find((mission) => mission.status === 'active' && mission.mission_number !== missionNumber);
|
|
215
|
+
if (!active)
|
|
216
|
+
return;
|
|
217
|
+
throw validationError('Single active mission', `cannot activate ${missionNumber} — mission ${active.mission_number} is already active. ` +
|
|
218
|
+
`Complete or cancel it first (orbitmap mission status ${active.mission_number} completed).`, { mission: missionNumber, active_mission: active.mission_number });
|
|
219
|
+
}
|
|
220
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
221
|
+
// Rule 6 — unique area slugs and document slugs
|
|
222
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
223
|
+
function assertUniqueSlug(rule, label, slug, existing) {
|
|
224
|
+
for (const candidate of existing) {
|
|
225
|
+
if (candidate === slug) {
|
|
226
|
+
throw validationError(rule, `${label} slug "${slug}" already exists in this workspace — pick another one.`, { slug });
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
/** Rule 6 — area slugs are unique within a workspace. */
|
|
231
|
+
export function assertUniqueAreaSlug(slug, existing) {
|
|
232
|
+
assertUniqueSlug('Unique area slug', 'Area', slug, existing);
|
|
233
|
+
}
|
|
234
|
+
/** Rule 6 — document slugs are unique within a workspace. */
|
|
235
|
+
export function assertUniqueDocumentSlug(slug, existing) {
|
|
236
|
+
assertUniqueSlug('Unique document slug', 'Document', slug, existing);
|
|
237
|
+
}
|
|
238
|
+
/** Build a dependency graph from task records (edge: task → each of its `depends_on`). */
|
|
239
|
+
export function buildDependencyGraph(tasks) {
|
|
240
|
+
const graph = new Map();
|
|
241
|
+
for (const task of tasks) {
|
|
242
|
+
graph.set(task.task_number, [...(task.depends_on ?? [])]);
|
|
243
|
+
}
|
|
244
|
+
return graph;
|
|
245
|
+
}
|
|
246
|
+
/** DFS: is `to` reachable from `from` by following depends_on edges? */
|
|
247
|
+
function reaches(graph, from, to) {
|
|
248
|
+
const seen = new Set();
|
|
249
|
+
const stack = [from];
|
|
250
|
+
while (stack.length > 0) {
|
|
251
|
+
const current = stack.pop();
|
|
252
|
+
if (current === to)
|
|
253
|
+
return true;
|
|
254
|
+
if (seen.has(current))
|
|
255
|
+
continue;
|
|
256
|
+
seen.add(current);
|
|
257
|
+
for (const next of graph.get(current) ?? []) {
|
|
258
|
+
if (!seen.has(next))
|
|
259
|
+
stack.push(next);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Rule 7 — reject a `depends_on` edge that would create a cycle.
|
|
266
|
+
*
|
|
267
|
+
* @param dependent the task that would depend on `dependency` (edge source)
|
|
268
|
+
* @param dependency the task depended upon (edge target)
|
|
269
|
+
* @param graph the current dependency graph (edge not yet added)
|
|
270
|
+
*/
|
|
271
|
+
export function assertNoDependencyCycle(dependent, dependency, graph) {
|
|
272
|
+
if (dependent === dependency) {
|
|
273
|
+
throw validationError('Dependency cycle', `${dependent} cannot depend on itself.`, { dependent, dependency });
|
|
274
|
+
}
|
|
275
|
+
if (reaches(graph, dependency, dependent)) {
|
|
276
|
+
throw validationError('Dependency cycle', `adding "${dependent} depends on ${dependency}" would create a circular dependency ` +
|
|
277
|
+
`(${dependency} already depends on ${dependent}, directly or transitively).`, { dependent, dependency });
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Rule 8 — pick the task `orbitmap start` (no id) should begin: the first `todo` task of
|
|
282
|
+
* the area, ordered by `sort_order` then `created_at`, restricted to tasks assigned to the
|
|
283
|
+
* local agent or unassigned. Pure selection — the caller performs the status write.
|
|
284
|
+
*
|
|
285
|
+
* @param tasks candidate tasks of the current area
|
|
286
|
+
* @param options `agent` = the local agent identity (default `local-agent`)
|
|
287
|
+
* @returns the selected task, or `null` when nothing is startable
|
|
288
|
+
*/
|
|
289
|
+
export function selectNextTask(tasks, options = {}) {
|
|
290
|
+
const agent = options.agent ?? 'local-agent';
|
|
291
|
+
const isEmpty = (value) => value === null || value === undefined || value === '';
|
|
292
|
+
const candidates = tasks.filter((task) => {
|
|
293
|
+
if (task.status !== 'todo')
|
|
294
|
+
return false;
|
|
295
|
+
// Assigned to the local agent → eligible, even if a user is named on it too.
|
|
296
|
+
if (task.assigned_agent === agent)
|
|
297
|
+
return true;
|
|
298
|
+
// Otherwise only genuinely unassigned tasks are eligible: a task the human took for
|
|
299
|
+
// themselves (`assigned_user` set) must not be grabbed by the agent.
|
|
300
|
+
return isEmpty(task.assigned_agent) && isEmpty(task.assigned_user);
|
|
301
|
+
});
|
|
302
|
+
if (candidates.length === 0)
|
|
303
|
+
return null;
|
|
304
|
+
const sorted = [...candidates].sort(compareStartOrder);
|
|
305
|
+
return sorted[0] ?? null;
|
|
306
|
+
}
|
|
307
|
+
/** Ordering used by `selectNextTask`: sort_order ascending, then created_at ascending. */
|
|
308
|
+
export function compareStartOrder(a, b) {
|
|
309
|
+
const orderA = a.sort_order ?? 0;
|
|
310
|
+
const orderB = b.sort_order ?? 0;
|
|
311
|
+
if (orderA !== orderB)
|
|
312
|
+
return orderA - orderB;
|
|
313
|
+
const createdA = a.created_at ?? '';
|
|
314
|
+
const createdB = b.created_at ?? '';
|
|
315
|
+
if (createdA !== createdB)
|
|
316
|
+
return createdA < createdB ? -1 : 1;
|
|
317
|
+
return 0;
|
|
318
|
+
}
|
|
319
|
+
//# sourceMappingURL=rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../../src/adapters/local/rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,uFAAuF;AACvF,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAEnD,wDAAwD;AACxD,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,0FAA0F;AAC1F,MAAM,UAAU,eAAe,CAC7B,IAAY,EACZ,OAAe,EACf,OAAiC;IAEjC,OAAO,IAAI,gBAAgB,CACzB,GAAG,IAAI,KAAK,OAAO,EAAE,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,OAAO,CACR,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,uDAAuD;AACvD,+EAA+E;AAE/E,wBAAwB;AACxB,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,SAAS;IACT,MAAM;IACN,aAAa;IACb,WAAW;IACX,gBAAgB;IAChB,MAAM;IACN,SAAS;CACD,CAAC;AAGX,gDAAgD;AAChD,MAAM,CAAC,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