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,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local file store (spec §4).
|
|
3
|
+
*
|
|
4
|
+
* All file I/O for local mode lives here: frontmatter+body parsing, atomic writes,
|
|
5
|
+
* advisory locking, the workspace scaffold, entity-number counters and lookups.
|
|
6
|
+
* It knows nothing about the Agent API envelopes (that is `shapes.ts`) and nothing
|
|
7
|
+
* about domain validation (that is `rules.ts`).
|
|
8
|
+
*
|
|
9
|
+
* Everything is async and every path is built with `node:path`, so the store behaves
|
|
10
|
+
* identically on Windows and POSIX.
|
|
11
|
+
*/
|
|
12
|
+
import { type AreaFile, type DocumentRecord, type EntityKind, type FoundEntity, type LocalFile, type LocalRecord, type RecordFor, type WorkspaceCounters, type WorkspaceFile } from './types.js';
|
|
13
|
+
/** Unexpected/corrupt state on disk (unreadable file, bad frontmatter, failed write). */
|
|
14
|
+
export declare const LOCAL_STORE_ERROR = "LOCAL_STORE_ERROR";
|
|
15
|
+
/** The advisory lock could not be acquired within the retry budget. */
|
|
16
|
+
export declare const LOCK_TIMEOUT = "LOCK_TIMEOUT";
|
|
17
|
+
/** A referenced entity/area/document does not exist on disk. */
|
|
18
|
+
export declare const NOT_FOUND = "NOT_FOUND";
|
|
19
|
+
export declare const WORKSPACE_FILE_NAME = "workspace.yml";
|
|
20
|
+
export declare const AREA_FILE_NAME = "area.yml";
|
|
21
|
+
export declare const LOCK_FILE_NAME = ".lock";
|
|
22
|
+
export declare const AREAS_DIR = "areas";
|
|
23
|
+
export declare const DOCUMENTS_DIR = "documents";
|
|
24
|
+
/** Workspace-level directories created by the scaffold. */
|
|
25
|
+
export declare const WORKSPACE_DIRS: readonly ["missions", "intents", "ideas", "documents", "issues"];
|
|
26
|
+
/** Per-area directories created by the scaffold. */
|
|
27
|
+
export declare const AREA_DIRS: readonly ["tasks", "issues", "vibes"];
|
|
28
|
+
/**
|
|
29
|
+
* Split a Markdown file into its YAML frontmatter object and its body.
|
|
30
|
+
*
|
|
31
|
+
* The delimiter is `---` on line 1. The *whole* YAML mapping is returned, so unknown
|
|
32
|
+
* keys survive a read → modify → write round trip.
|
|
33
|
+
*/
|
|
34
|
+
export declare function parseFrontmatter<T extends LocalRecord = LocalRecord>(raw: string, source?: string): {
|
|
35
|
+
frontmatter: T;
|
|
36
|
+
body: string;
|
|
37
|
+
};
|
|
38
|
+
/** Render a frontmatter object + body back into a Markdown file. */
|
|
39
|
+
export declare function serialiseFrontmatter(frontmatter: LocalRecord, body?: string): string;
|
|
40
|
+
/** `prefix + '-' + counter.toString(36).padStart(6, '0')`, e.g. `TS-000001`. */
|
|
41
|
+
export declare function formatEntityNumber(kind: EntityKind, counter: number): string;
|
|
42
|
+
/** The entity kind an entity number belongs to, or `undefined` if not a number. */
|
|
43
|
+
export declare function kindOfEntityNumber(ref: string): EntityKind | undefined;
|
|
44
|
+
/** True when `ref` looks like `TS-…`/`IS-…`/… rather than a uuid or slug. */
|
|
45
|
+
export declare function isEntityNumber(ref: string): boolean;
|
|
46
|
+
export interface LocalStoreOptions {
|
|
47
|
+
/** Lock acquisition attempts before failing. Default 10 (spec §4.12). */
|
|
48
|
+
lockRetries?: number;
|
|
49
|
+
/** Delay between lock attempts, in ms. Default 100 (spec §4.12). */
|
|
50
|
+
lockRetryDelayMs?: number;
|
|
51
|
+
}
|
|
52
|
+
export interface ScaffoldOptions {
|
|
53
|
+
/** Workspace display name. */
|
|
54
|
+
name: string;
|
|
55
|
+
/** Workspace slug. Defaults to a slugified `name`. */
|
|
56
|
+
slug?: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
/** Pre-generated workspace uuid (mainly for tests). */
|
|
59
|
+
workspaceId?: string;
|
|
60
|
+
/** Optional first area created alongside the workspace. */
|
|
61
|
+
area?: CreateAreaInput;
|
|
62
|
+
}
|
|
63
|
+
export interface CreateAreaInput {
|
|
64
|
+
name: string;
|
|
65
|
+
slug?: string;
|
|
66
|
+
description?: string;
|
|
67
|
+
gitUrl?: string | null;
|
|
68
|
+
defaultBranch?: string;
|
|
69
|
+
agentInstructionsTemplate?: string | null;
|
|
70
|
+
areaId?: string;
|
|
71
|
+
}
|
|
72
|
+
export declare class LocalStore {
|
|
73
|
+
/** Absolute path of the workspace root directory. */
|
|
74
|
+
readonly root: string;
|
|
75
|
+
private readonly lockRetries;
|
|
76
|
+
private readonly lockRetryDelayMs;
|
|
77
|
+
constructor(workspacePath: string, options?: LocalStoreOptions);
|
|
78
|
+
get workspaceFile(): string;
|
|
79
|
+
get lockFile(): string;
|
|
80
|
+
/** `<root>/areas/<slug>`. */
|
|
81
|
+
areaDir(slug: string): string;
|
|
82
|
+
/** `<root>/areas/<slug>/area.yml`. */
|
|
83
|
+
areaFile(slug: string): string;
|
|
84
|
+
/**
|
|
85
|
+
* Directory holding entities of `kind`. Area-scoped kinds require `area`;
|
|
86
|
+
* issues live in the area dir when `area` is given and in `<root>/issues` otherwise.
|
|
87
|
+
*/
|
|
88
|
+
entityDir(kind: EntityKind, area?: string | null): string;
|
|
89
|
+
/** Absolute path of an entity file. */
|
|
90
|
+
entityPath(kind: EntityKind, entityNumber: string, area?: string | null): string;
|
|
91
|
+
/** `<root>/documents/<slug>.md`. */
|
|
92
|
+
documentPath(slug: string): string;
|
|
93
|
+
/** True when `<root>/workspace.yml` exists. */
|
|
94
|
+
isWorkspace(): Promise<boolean>;
|
|
95
|
+
/**
|
|
96
|
+
* Create the full directory layout of §4.1 plus `workspace.yml`, and optionally the
|
|
97
|
+
* first area. Idempotent: re-scaffolding an existing workspace only fills in gaps and
|
|
98
|
+
* leaves `workspace.yml` (and its counters) untouched.
|
|
99
|
+
*/
|
|
100
|
+
scaffold(options: ScaffoldOptions): Promise<WorkspaceFile>;
|
|
101
|
+
/**
|
|
102
|
+
* Create `areas/<slug>/` with its `tasks/`, `issues/`, `vibes/` subdirectories and
|
|
103
|
+
* `area.yml`. Returns the existing `area.yml` untouched when the area already exists.
|
|
104
|
+
*/
|
|
105
|
+
scaffoldArea(input: CreateAreaInput): Promise<AreaFile>;
|
|
106
|
+
readWorkspace(): Promise<WorkspaceFile>;
|
|
107
|
+
writeWorkspace(workspace: WorkspaceFile): Promise<void>;
|
|
108
|
+
readArea(slug: string): Promise<AreaFile>;
|
|
109
|
+
tryReadArea(slug: string): Promise<AreaFile | undefined>;
|
|
110
|
+
writeArea(area: AreaFile): Promise<void>;
|
|
111
|
+
/** Every area in the workspace, ordered by slug. */
|
|
112
|
+
listAreas(): Promise<AreaFile[]>;
|
|
113
|
+
/** Look an area up by slug; `undefined` when it does not exist. */
|
|
114
|
+
findAreaBySlug(slug: string): Promise<AreaFile | undefined>;
|
|
115
|
+
/**
|
|
116
|
+
* Run `fn` while holding the workspace's advisory `.lock` file.
|
|
117
|
+
*
|
|
118
|
+
* Guards multi-file operations (counter bump + entity write) against concurrent CLI
|
|
119
|
+
* invocations. Reentrant within one async context, serialised within one process, and
|
|
120
|
+
* retried `lockRetries` × `lockRetryDelayMs` against other processes before failing.
|
|
121
|
+
* The lock is always released in a `finally`.
|
|
122
|
+
*/
|
|
123
|
+
withLock<T>(fn: () => Promise<T>): Promise<T>;
|
|
124
|
+
private acquireLockFile;
|
|
125
|
+
private releaseLockFile;
|
|
126
|
+
/**
|
|
127
|
+
* Bump the counter for `kind` in `workspace.yml` and return the new entity number.
|
|
128
|
+
* Runs under the advisory lock, so concurrent creates never collide.
|
|
129
|
+
*/
|
|
130
|
+
nextEntityNumber(kind: EntityKind): Promise<string>;
|
|
131
|
+
/**
|
|
132
|
+
* Allocate the next entity number and write the file in a single locked operation.
|
|
133
|
+
* `build` receives the freshly allocated number and returns the record to persist.
|
|
134
|
+
*/
|
|
135
|
+
createEntity<K extends EntityKind>(kind: K, build: (entityNumber: string) => {
|
|
136
|
+
frontmatter: RecordFor<K>;
|
|
137
|
+
body?: string;
|
|
138
|
+
}, options?: {
|
|
139
|
+
area?: string | null;
|
|
140
|
+
}): Promise<FoundEntity<K>>;
|
|
141
|
+
/** Read an entity file by kind + number. Throws `NOT_FOUND` when missing. */
|
|
142
|
+
readEntity<K extends EntityKind>(kind: K, entityNumber: string, options?: {
|
|
143
|
+
area?: string | null;
|
|
144
|
+
}): Promise<FoundEntity<K>>;
|
|
145
|
+
/** Read an entity file by kind + number, or `undefined` when it does not exist. */
|
|
146
|
+
tryReadEntity<K extends EntityKind>(kind: K, entityNumber: string, options?: {
|
|
147
|
+
area?: string | null;
|
|
148
|
+
}): Promise<FoundEntity<K> | undefined>;
|
|
149
|
+
/** Persist an entity file that was previously read (or built) by the store. */
|
|
150
|
+
writeEntity<K extends EntityKind>(file: FoundEntity<K>): Promise<void>;
|
|
151
|
+
/** Write a raw frontmatter+body pair to an explicit path (atomic). */
|
|
152
|
+
writeFileRecord(path: string, frontmatter: LocalRecord, body?: string): Promise<void>;
|
|
153
|
+
/**
|
|
154
|
+
* Locate any entity by its entity number (`TS-000001`) or by its uuid.
|
|
155
|
+
*
|
|
156
|
+
* Entity numbers resolve directly from the prefix + directory layout; uuids require a
|
|
157
|
+
* scan of the workspace (small by construction). Returns `undefined` when not found.
|
|
158
|
+
*/
|
|
159
|
+
findEntity(ref: string): Promise<FoundEntity | undefined>;
|
|
160
|
+
/** Like {@link findEntity} but throws `NOT_FOUND` instead of returning `undefined`. */
|
|
161
|
+
requireEntity(ref: string): Promise<FoundEntity>;
|
|
162
|
+
/**
|
|
163
|
+
* All entities of one kind.
|
|
164
|
+
*
|
|
165
|
+
* - Area-scoped kinds (`task`, `vibe`): `area` restricts to that area; omitting it
|
|
166
|
+
* walks every area.
|
|
167
|
+
* - `issue`: `area` restricts to that area; omitting it returns workspace-level issues
|
|
168
|
+
* *and* every area's issues.
|
|
169
|
+
* - Workspace-scoped kinds: `area` is ignored.
|
|
170
|
+
*
|
|
171
|
+
* Results are sorted by entity number for stable output.
|
|
172
|
+
*/
|
|
173
|
+
listEntities<K extends EntityKind>(kind: K, options?: {
|
|
174
|
+
area?: string | null;
|
|
175
|
+
}): Promise<FoundEntity<K>[]>;
|
|
176
|
+
/** Read `documents/<slug>.md`, or `undefined` when it does not exist. */
|
|
177
|
+
findDocumentBySlug(slug: string): Promise<LocalFile<DocumentRecord> | undefined>;
|
|
178
|
+
/** Like {@link findDocumentBySlug} but throws `NOT_FOUND` when missing. */
|
|
179
|
+
readDocument(slug: string): Promise<LocalFile<DocumentRecord>>;
|
|
180
|
+
/** Every document in `documents/`, ordered by slug. */
|
|
181
|
+
listDocuments(): Promise<LocalFile<DocumentRecord>[]>;
|
|
182
|
+
/** Write `documents/<slug>.md` atomically. */
|
|
183
|
+
writeDocument(frontmatter: DocumentRecord, body: string): Promise<LocalFile<DocumentRecord>>;
|
|
184
|
+
/** Area slugs (or `null` for workspace scope) to search for `kind`. */
|
|
185
|
+
private scopesFor;
|
|
186
|
+
/** Every path an entity number could occupy, in search order. */
|
|
187
|
+
private candidatePaths;
|
|
188
|
+
private readEntityAt;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Atomic write: serialise to `<file>.tmp` in the same directory, then rename over the
|
|
192
|
+
* target. The temp file is removed on any failure, so no `.tmp` litter is left behind.
|
|
193
|
+
*/
|
|
194
|
+
export declare function writeAtomic(path: string, content: string): Promise<void>;
|
|
195
|
+
/** Fresh counters, all at zero. */
|
|
196
|
+
export declare function emptyCounters(): WorkspaceCounters;
|
|
197
|
+
/** ISO-8601 UTC, second precision — the timestamp format used across the format. */
|
|
198
|
+
export declare function nowIso(): string;
|
|
199
|
+
/** Lowercase, dash-separated slug — used for workspace/area defaults. */
|
|
200
|
+
export declare function slugify(value: string): string;
|