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 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../src/adapters/local/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,cAAc,GAEf,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,SAAS,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,KAAK,MAAM,qBAAqB,CA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AC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,EAC9B,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAC1C,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,mBAAmB;QACvB,OAAO,wBAAwB,CAAC,MAAM,eAAe,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC3E,CAAC;CACF"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared runtime context for the LocalAdapter (spec §2.2, §3.3).
|
|
3
|
+
*
|
|
4
|
+
* Every local entity module receives a {@link LocalContext} as its first argument:
|
|
5
|
+
* the file store, the resolved workspace directory, the parsed `workspace.yml` and the
|
|
6
|
+
* resolved area slug. The context is built once per adapter instance, so a command pays
|
|
7
|
+
* for at most one `workspace.yml` read.
|
|
8
|
+
*
|
|
9
|
+
* This module also owns the *implicit identities* of local mode (there is exactly one
|
|
10
|
+
* user, `me`, and one agent, `local-agent` — spec §1 non-goals) and the two error
|
|
11
|
+
* helpers every module shares.
|
|
12
|
+
*/
|
|
13
|
+
import { OrbitMapAPIError } from '../../errors.js';
|
|
14
|
+
import { type AreaSource } from '../../workspace-resolve.js';
|
|
15
|
+
import { LocalStore, type LocalStoreOptions } from './store.js';
|
|
16
|
+
import type { AreaFile, WorkspaceFile } from './types.js';
|
|
17
|
+
/** The feature exists in cloud mode but is out of scope for local mode (spec §1). */
|
|
18
|
+
export declare const NOT_SUPPORTED_IN_LOCAL_MODE = "NOT_SUPPORTED_IN_LOCAL_MODE";
|
|
19
|
+
/** The local implementation of this method has not landed yet. */
|
|
20
|
+
export declare const NOT_IMPLEMENTED_YET = "NOT_IMPLEMENTED_YET";
|
|
21
|
+
/** The single implicit agent of a local workspace. */
|
|
22
|
+
export declare const LOCAL_AGENT_ID = "local-agent";
|
|
23
|
+
export declare const LOCAL_AGENT_SLUG = "local-agent";
|
|
24
|
+
export declare const LOCAL_AGENT_NAME = "Local Agent";
|
|
25
|
+
export declare const LOCAL_AGENT_INTRODUCTION = "You are the local OrbitMap agent. This workspace is stored as Markdown files on disk.";
|
|
26
|
+
/** The single implicit user of a local workspace. */
|
|
27
|
+
export declare const LOCAL_USER_ID = 1;
|
|
28
|
+
export declare const LOCAL_USER_NAME = "me";
|
|
29
|
+
export declare const LOCAL_USER_EMAIL = "me@localhost";
|
|
30
|
+
/** Role every implicit member carries in the members envelope. */
|
|
31
|
+
export declare const LOCAL_MEMBER_ROLE = "member";
|
|
32
|
+
/** `created_by` value written into every locally created record. */
|
|
33
|
+
export declare const LOCAL_CREATED_BY = "agent:local-agent";
|
|
34
|
+
/** Server-only fields that get stable placeholders locally (spec §2.2). */
|
|
35
|
+
export declare const LOCAL_ACCOUNT_ID = 0;
|
|
36
|
+
export declare const LOCAL_CREATED_BY_TYPE = "agent";
|
|
37
|
+
/** Everything a local entity module needs to serve one adapter call. */
|
|
38
|
+
export interface LocalContext {
|
|
39
|
+
/** File store rooted at {@link LocalContext.workspacePath}. */
|
|
40
|
+
store: LocalStore;
|
|
41
|
+
/** Absolute path of the workspace directory. */
|
|
42
|
+
workspacePath: string;
|
|
43
|
+
/** Parsed `workspace.yml` as it was when the adapter was created. */
|
|
44
|
+
workspace: WorkspaceFile;
|
|
45
|
+
/**
|
|
46
|
+
* Resolved area slug, or `undefined` when no area could be resolved.
|
|
47
|
+
* Auto-selected when the workspace contains exactly one area (spec §3.3).
|
|
48
|
+
*/
|
|
49
|
+
areaSlug?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface CreateLocalContextOptions {
|
|
52
|
+
/** Absolute (or cwd-relative) workspace directory. */
|
|
53
|
+
workspacePath: string;
|
|
54
|
+
/** Area slug resolved by `workspace-resolve.ts`, when one was found. */
|
|
55
|
+
area?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Which rung produced {@link CreateLocalContextOptions.area}. Omitted (or anything
|
|
58
|
+
* other than `'config'`) is treated as an explicit request.
|
|
59
|
+
*/
|
|
60
|
+
areaSource?: AreaSource;
|
|
61
|
+
/** Store tuning (lock retries) — mainly for tests. */
|
|
62
|
+
storeOptions?: LocalStoreOptions;
|
|
63
|
+
/** Pre-built store; when given, `workspacePath` is ignored. */
|
|
64
|
+
store?: LocalStore;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Build the context: opens the store, reads `workspace.yml` (failing with
|
|
68
|
+
* `WORKSPACE_NOT_FOUND` when the directory is not a workspace) and applies the rungs of
|
|
69
|
+
* area resolution that need the workspace on disk (spec §3.3).
|
|
70
|
+
*
|
|
71
|
+
* The full ladder, first match wins:
|
|
72
|
+
* `--area` → `ORBITMAP_AREA` → `link.json.area` → nearest `.orbitmap/config.json` `area`
|
|
73
|
+
* (ADR 0002) → **`workspace.yml` `default_area`** → global config `area` (deprecated) →
|
|
74
|
+
* single-area auto-select → `AREA_CONTEXT_REQUIRED`.
|
|
75
|
+
*
|
|
76
|
+
* The first four rungs arrive here already resolved (as `area` + `areaSource`); this
|
|
77
|
+
* function owns the last three. Two rules make the ordering safe:
|
|
78
|
+
*
|
|
79
|
+
* - **The workspace outranks the machine.** `default_area` is what this workspace knows
|
|
80
|
+
* about itself, so it wins over the global config's `area`, which may well belong to an
|
|
81
|
+
* unrelated (cloud) project on the same machine.
|
|
82
|
+
* - **Legacy leniency.** When the slug came from the weakest rung (global config) and no
|
|
83
|
+
* such area exists here, we fall through instead of failing: a workspace created before
|
|
84
|
+
* `default_area` existed still resolves to its single area, or reports
|
|
85
|
+
* `AREA_CONTEXT_REQUIRED` listing what it does have. An area named *explicitly*
|
|
86
|
+
* (`--area`, `ORBITMAP_AREA`, `link.json`, `default_area`) is never silently swapped —
|
|
87
|
+
* it stays and the usual `NOT_FOUND` is raised downstream.
|
|
88
|
+
*/
|
|
89
|
+
export declare function createLocalContext(options: CreateLocalContextOptions): Promise<LocalContext>;
|
|
90
|
+
/** Every area slug in the workspace, ordered. */
|
|
91
|
+
export declare function listAreaSlugs(ctx: LocalContext): Promise<string[]>;
|
|
92
|
+
/**
|
|
93
|
+
* The resolved area slug, or `AREA_CONTEXT_REQUIRED` when none could be resolved.
|
|
94
|
+
* The available slugs are surfaced in the error details.
|
|
95
|
+
*/
|
|
96
|
+
export declare function requireAreaSlug(ctx: LocalContext): Promise<string>;
|
|
97
|
+
/** The resolved area's `area.yml`; throws when no area is resolved or it is missing. */
|
|
98
|
+
export declare function requireAreaFile(ctx: LocalContext): Promise<AreaFile>;
|
|
99
|
+
/**
|
|
100
|
+
* Resolve an area reference that may be a slug **or** an area uuid (commands resolve
|
|
101
|
+
* slugs to uuids before calling `members`/`overview`). Falls back to the context area.
|
|
102
|
+
*/
|
|
103
|
+
export declare function resolveAreaRef(ctx: LocalContext, ref?: string): Promise<AreaFile>;
|
|
104
|
+
/**
|
|
105
|
+
* The standard "cloud-only feature" rejection. `feature` names the command surface,
|
|
106
|
+
* e.g. `orbit commands` or `doc-share`.
|
|
107
|
+
*/
|
|
108
|
+
export declare function notSupported(feature: string): OrbitMapAPIError;
|
|
109
|
+
/** Placeholder for local surfaces that are still being implemented. */
|
|
110
|
+
export declare function notImplemented(feature: string): OrbitMapAPIError;
|
|
111
|
+
/** Fresh uuid for a newly created record (spec §2.2: `id` is a generated UUIDv4). */
|
|
112
|
+
export declare function newId(): string;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared runtime context for the LocalAdapter (spec §2.2, §3.3).
|
|
3
|
+
*
|
|
4
|
+
* Every local entity module receives a {@link LocalContext} as its first argument:
|
|
5
|
+
* the file store, the resolved workspace directory, the parsed `workspace.yml` and the
|
|
6
|
+
* resolved area slug. The context is built once per adapter instance, so a command pays
|
|
7
|
+
* for at most one `workspace.yml` read.
|
|
8
|
+
*
|
|
9
|
+
* This module also owns the *implicit identities* of local mode (there is exactly one
|
|
10
|
+
* user, `me`, and one agent, `local-agent` — spec §1 non-goals) and the two error
|
|
11
|
+
* helpers every module shares.
|
|
12
|
+
*/
|
|
13
|
+
import { randomUUID } from 'node:crypto';
|
|
14
|
+
import { OrbitMapAPIError } from '../../errors.js';
|
|
15
|
+
import { requireArea } from '../../workspace-resolve.js';
|
|
16
|
+
import { LocalStore } from './store.js';
|
|
17
|
+
// ── Error codes ─────────────────────────────────────────────────────────────
|
|
18
|
+
/** The feature exists in cloud mode but is out of scope for local mode (spec §1). */
|
|
19
|
+
export const NOT_SUPPORTED_IN_LOCAL_MODE = 'NOT_SUPPORTED_IN_LOCAL_MODE';
|
|
20
|
+
/** The local implementation of this method has not landed yet. */
|
|
21
|
+
export const NOT_IMPLEMENTED_YET = 'NOT_IMPLEMENTED_YET';
|
|
22
|
+
// ── Implicit identities (spec §2.2) ─────────────────────────────────────────
|
|
23
|
+
/** The single implicit agent of a local workspace. */
|
|
24
|
+
export const LOCAL_AGENT_ID = 'local-agent';
|
|
25
|
+
export const LOCAL_AGENT_SLUG = 'local-agent';
|
|
26
|
+
export const LOCAL_AGENT_NAME = 'Local Agent';
|
|
27
|
+
export const LOCAL_AGENT_INTRODUCTION = 'You are the local OrbitMap agent. This workspace is stored as Markdown files on disk.';
|
|
28
|
+
/** The single implicit user of a local workspace. */
|
|
29
|
+
export const LOCAL_USER_ID = 1;
|
|
30
|
+
export const LOCAL_USER_NAME = 'me';
|
|
31
|
+
export const LOCAL_USER_EMAIL = 'me@localhost';
|
|
32
|
+
/** Role every implicit member carries in the members envelope. */
|
|
33
|
+
export const LOCAL_MEMBER_ROLE = 'member';
|
|
34
|
+
/** `created_by` value written into every locally created record. */
|
|
35
|
+
export const LOCAL_CREATED_BY = `agent:${LOCAL_AGENT_SLUG}`;
|
|
36
|
+
/** Server-only fields that get stable placeholders locally (spec §2.2). */
|
|
37
|
+
export const LOCAL_ACCOUNT_ID = 0;
|
|
38
|
+
export const LOCAL_CREATED_BY_TYPE = 'agent';
|
|
39
|
+
/**
|
|
40
|
+
* Build the context: opens the store, reads `workspace.yml` (failing with
|
|
41
|
+
* `WORKSPACE_NOT_FOUND` when the directory is not a workspace) and applies the rungs of
|
|
42
|
+
* area resolution that need the workspace on disk (spec §3.3).
|
|
43
|
+
*
|
|
44
|
+
* The full ladder, first match wins:
|
|
45
|
+
* `--area` → `ORBITMAP_AREA` → `link.json.area` → nearest `.orbitmap/config.json` `area`
|
|
46
|
+
* (ADR 0002) → **`workspace.yml` `default_area`** → global config `area` (deprecated) →
|
|
47
|
+
* single-area auto-select → `AREA_CONTEXT_REQUIRED`.
|
|
48
|
+
*
|
|
49
|
+
* The first four rungs arrive here already resolved (as `area` + `areaSource`); this
|
|
50
|
+
* function owns the last three. Two rules make the ordering safe:
|
|
51
|
+
*
|
|
52
|
+
* - **The workspace outranks the machine.** `default_area` is what this workspace knows
|
|
53
|
+
* about itself, so it wins over the global config's `area`, which may well belong to an
|
|
54
|
+
* unrelated (cloud) project on the same machine.
|
|
55
|
+
* - **Legacy leniency.** When the slug came from the weakest rung (global config) and no
|
|
56
|
+
* such area exists here, we fall through instead of failing: a workspace created before
|
|
57
|
+
* `default_area` existed still resolves to its single area, or reports
|
|
58
|
+
* `AREA_CONTEXT_REQUIRED` listing what it does have. An area named *explicitly*
|
|
59
|
+
* (`--area`, `ORBITMAP_AREA`, `link.json`, `default_area`) is never silently swapped —
|
|
60
|
+
* it stays and the usual `NOT_FOUND` is raised downstream.
|
|
61
|
+
*/
|
|
62
|
+
export async function createLocalContext(options) {
|
|
63
|
+
const store = options.store ?? new LocalStore(options.workspacePath, options.storeOptions);
|
|
64
|
+
if (!(await store.isWorkspace())) {
|
|
65
|
+
throw OrbitMapAPIError.workspaceNotFound(`No OrbitMap workspace found at ${store.root}. Run \`orbitmap init\` to create one.`);
|
|
66
|
+
}
|
|
67
|
+
const workspace = await store.readWorkspace();
|
|
68
|
+
let areaSlug = options.area;
|
|
69
|
+
const fromGlobalConfig = areaSlug !== undefined && options.areaSource === 'config';
|
|
70
|
+
if (areaSlug === undefined || fromGlobalConfig) {
|
|
71
|
+
const declared = typeof workspace.default_area === 'string' ? workspace.default_area.trim() : '';
|
|
72
|
+
if (declared) {
|
|
73
|
+
areaSlug = declared;
|
|
74
|
+
}
|
|
75
|
+
else if (fromGlobalConfig && !(await store.tryReadArea(areaSlug))) {
|
|
76
|
+
areaSlug = undefined;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (!areaSlug) {
|
|
80
|
+
const areas = await store.listAreas();
|
|
81
|
+
if (areas.length === 1)
|
|
82
|
+
areaSlug = areas[0].slug;
|
|
83
|
+
}
|
|
84
|
+
return { store, workspacePath: store.root, workspace, areaSlug };
|
|
85
|
+
}
|
|
86
|
+
// ── Area helpers ────────────────────────────────────────────────────────────
|
|
87
|
+
/** Every area slug in the workspace, ordered. */
|
|
88
|
+
export async function listAreaSlugs(ctx) {
|
|
89
|
+
return (await ctx.store.listAreas()).map((area) => area.slug);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The resolved area slug, or `AREA_CONTEXT_REQUIRED` when none could be resolved.
|
|
93
|
+
* The available slugs are surfaced in the error details.
|
|
94
|
+
*/
|
|
95
|
+
export async function requireAreaSlug(ctx) {
|
|
96
|
+
if (ctx.areaSlug)
|
|
97
|
+
return ctx.areaSlug;
|
|
98
|
+
return requireArea(undefined, await listAreaSlugs(ctx));
|
|
99
|
+
}
|
|
100
|
+
/** The resolved area's `area.yml`; throws when no area is resolved or it is missing. */
|
|
101
|
+
export async function requireAreaFile(ctx) {
|
|
102
|
+
return ctx.store.readArea(await requireAreaSlug(ctx));
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Resolve an area reference that may be a slug **or** an area uuid (commands resolve
|
|
106
|
+
* slugs to uuids before calling `members`/`overview`). Falls back to the context area.
|
|
107
|
+
*/
|
|
108
|
+
export async function resolveAreaRef(ctx, ref) {
|
|
109
|
+
if (!ref)
|
|
110
|
+
return requireAreaFile(ctx);
|
|
111
|
+
const bySlug = await ctx.store.findAreaBySlug(ref);
|
|
112
|
+
if (bySlug)
|
|
113
|
+
return bySlug;
|
|
114
|
+
const areas = await ctx.store.listAreas();
|
|
115
|
+
const byId = areas.find((area) => area.area_id === ref);
|
|
116
|
+
if (byId)
|
|
117
|
+
return byId;
|
|
118
|
+
throw new OrbitMapAPIError(`Area \`${ref}\` was not found in this workspace.`, 'NOT_FOUND', 404, { available_areas: areas.map((area) => area.slug) });
|
|
119
|
+
}
|
|
120
|
+
// ── Errors ──────────────────────────────────────────────────────────────────
|
|
121
|
+
/**
|
|
122
|
+
* The standard "cloud-only feature" rejection. `feature` names the command surface,
|
|
123
|
+
* e.g. `orbit commands` or `doc-share`.
|
|
124
|
+
*/
|
|
125
|
+
export function notSupported(feature) {
|
|
126
|
+
return new OrbitMapAPIError(`${feature} is not supported in local mode yet — it requires an Orbitmap.ai workspace.`, NOT_SUPPORTED_IN_LOCAL_MODE, 400);
|
|
127
|
+
}
|
|
128
|
+
/** Placeholder for local surfaces that are still being implemented. */
|
|
129
|
+
export function notImplemented(feature) {
|
|
130
|
+
return new OrbitMapAPIError(`${feature} is not implemented for local mode yet.`, NOT_IMPLEMENTED_YET, 501);
|
|
131
|
+
}
|
|
132
|
+
// ── Misc ────────────────────────────────────────────────────────────────────
|
|
133
|
+
/** Fresh uuid for a newly created record (spec §2.2: `id` is a generated UUIDv4). */
|
|
134
|
+
export function newId() {
|
|
135
|
+
return randomUUID();
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/adapters/local/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAmB,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,UAAU,EAA0B,MAAM,YAAY,CAAC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Ac,CAAC,OAAe;IAC5C,OAAO,IAAI,gBAAgB,CACzB,GAAG,OAAO,yCAAyC,EACnD,mBAAmB,EACnB,GAAG,CACJ,CAAC;AACJ,CAAC;AAED,+EAA+E;AAE/E,qFAAqF;AACrF,MAAM,UAAU,KAAK;IACnB,OAAO,UAAU,EAAE,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local-mode documents — simple profile (spec §4.11, task T9).
|
|
3
|
+
*
|
|
4
|
+
* Conventions every function follows:
|
|
5
|
+
* - first parameter is the shared {@link LocalContext} (store, workspace, area slug);
|
|
6
|
+
* - the remaining parameters are exactly the `WorkspaceAdapter` method parameters;
|
|
7
|
+
* - the return value is the raw Agent API envelope (`{ data: … }`, plus `meta` where the
|
|
8
|
+
* fixtures have one); `../shapes.js` exposes `documentEntry` and `countSections`
|
|
9
|
+
* (the `##`-scan behind `sections_count` and the table of contents);
|
|
10
|
+
* - validation goes through `../rules.js` (`assertDocumentType`, `assertDocumentStatus`,
|
|
11
|
+
* `assertUniqueDocumentSlug`), never re-implemented here.
|
|
12
|
+
*
|
|
13
|
+
* Section-level patching, sharing, visibility and presigned uploads are out of scope:
|
|
14
|
+
* the adapter answers those methods with `NOT_SUPPORTED_IN_LOCAL_MODE` and never reaches
|
|
15
|
+
* this module.
|
|
16
|
+
*
|
|
17
|
+
* The table of contents is NEVER stored: both `sections_count` and `table_of_contents`
|
|
18
|
+
* are computed by scanning the body for `##` headings every time a document is read.
|
|
19
|
+
*/
|
|
20
|
+
import { type LocalContext } from '../context.js';
|
|
21
|
+
import type { DocumentRecord, LocalFile } from '../types.js';
|
|
22
|
+
/** One entry of the computed table of contents. */
|
|
23
|
+
interface TocEntry {
|
|
24
|
+
heading: string;
|
|
25
|
+
level: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Table of contents: the `##` headings of the body, in document order (spec §4.11).
|
|
29
|
+
* `heading` carries the full heading line (`## Auth`) so it can be passed straight back
|
|
30
|
+
* as `orbitmap doc <slug> --section "## Auth"`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function tableOfContents(body: string): TocEntry[];
|
|
33
|
+
/**
|
|
34
|
+
* Extract exactly one section: the matching heading line plus everything up to the next
|
|
35
|
+
* heading of the same or a higher level. Nested sub-headings stay inside the section.
|
|
36
|
+
*/
|
|
37
|
+
export declare function extractSection(body: string, section: string): string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Resolve a document reference: its slug, its uuid, or a title that slugifies to an
|
|
40
|
+
* existing slug. Throws `NOT_FOUND` when nothing matches.
|
|
41
|
+
*/
|
|
42
|
+
export declare function requireDocument(ctx: LocalContext, idOrSlug: string): Promise<LocalFile<DocumentRecord>>;
|
|
43
|
+
/**
|
|
44
|
+
* `GET /documents` — every document in `documents/`, with the computed `sections_count`
|
|
45
|
+
* and the `context` line the agent uses to decide what to read.
|
|
46
|
+
*
|
|
47
|
+
* `type` filters on the document type, `search` matches title, slug, context and body
|
|
48
|
+
* case-insensitively. `areaId` is ignored: local documents are workspace-scoped (§4.1).
|
|
49
|
+
*/
|
|
50
|
+
export declare function getDocuments(ctx: LocalContext, options?: {
|
|
51
|
+
type?: string;
|
|
52
|
+
search?: string;
|
|
53
|
+
areaId?: string;
|
|
54
|
+
}): Promise<unknown>;
|
|
55
|
+
/**
|
|
56
|
+
* `GET /documents/{id}` in its three flavours:
|
|
57
|
+
*
|
|
58
|
+
* - default — context + computed table of contents (cheap);
|
|
59
|
+
* - `options.section` — the requested section only, in `content`;
|
|
60
|
+
* - `mode: 'file'` / `options.full` — the full body in `content`, plus `file_path`, the
|
|
61
|
+
* absolute path of the Markdown file on disk (spec §2.2 — local mode has no URLs).
|
|
62
|
+
*/
|
|
63
|
+
export declare function getDocument(ctx: LocalContext, idOrSlug: string, mode?: 'inline' | 'file', options?: {
|
|
64
|
+
full?: boolean;
|
|
65
|
+
section?: string;
|
|
66
|
+
}): Promise<unknown>;
|
|
67
|
+
/**
|
|
68
|
+
* `POST /documents` — write `documents/<slug>.md` in the §4.11 format: slug derived from
|
|
69
|
+
* the title (unique per workspace), `version: 1`, `status: draft`.
|
|
70
|
+
*/
|
|
71
|
+
export declare function importDocument(ctx: LocalContext, data: {
|
|
72
|
+
title: string;
|
|
73
|
+
type: string;
|
|
74
|
+
content: string;
|
|
75
|
+
source_path?: string;
|
|
76
|
+
context?: string;
|
|
77
|
+
workspace_id?: string;
|
|
78
|
+
}): Promise<unknown>;
|
|
79
|
+
/**
|
|
80
|
+
* `PUT /documents/{id}` — replace the body, bump `version` and `updated_at`. Unknown
|
|
81
|
+
* frontmatter keys are preserved (read → modify → write). `changelog` is accepted for
|
|
82
|
+
* API parity but not persisted: the PoC keeps no version history (spec §4.11).
|
|
83
|
+
*/
|
|
84
|
+
export declare function updateDocument(ctx: LocalContext, idOrSlug: string, content: string, _changelog?: string): Promise<unknown>;
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local-mode documents — simple profile (spec §4.11, task T9).
|
|
3
|
+
*
|
|
4
|
+
* Conventions every function follows:
|
|
5
|
+
* - first parameter is the shared {@link LocalContext} (store, workspace, area slug);
|
|
6
|
+
* - the remaining parameters are exactly the `WorkspaceAdapter` method parameters;
|
|
7
|
+
* - the return value is the raw Agent API envelope (`{ data: … }`, plus `meta` where the
|
|
8
|
+
* fixtures have one); `../shapes.js` exposes `documentEntry` and `countSections`
|
|
9
|
+
* (the `##`-scan behind `sections_count` and the table of contents);
|
|
10
|
+
* - validation goes through `../rules.js` (`assertDocumentType`, `assertDocumentStatus`,
|
|
11
|
+
* `assertUniqueDocumentSlug`), never re-implemented here.
|
|
12
|
+
*
|
|
13
|
+
* Section-level patching, sharing, visibility and presigned uploads are out of scope:
|
|
14
|
+
* the adapter answers those methods with `NOT_SUPPORTED_IN_LOCAL_MODE` and never reaches
|
|
15
|
+
* this module.
|
|
16
|
+
*
|
|
17
|
+
* The table of contents is NEVER stored: both `sections_count` and `table_of_contents`
|
|
18
|
+
* are computed by scanning the body for `##` headings every time a document is read.
|
|
19
|
+
*/
|
|
20
|
+
import { OrbitMapAPIError } from '../../../errors.js';
|
|
21
|
+
import { LOCAL_CREATED_BY, newId } from '../context.js';
|
|
22
|
+
import { assertDocumentStatus, assertDocumentType, assertUniqueDocumentSlug, } from '../rules.js';
|
|
23
|
+
import { countSections } from '../shapes.js';
|
|
24
|
+
import { nowIso, slugify } from '../store.js';
|
|
25
|
+
/** Every locally imported document starts as a draft at version 1 (spec §4.11). */
|
|
26
|
+
const INITIAL_STATUS = 'draft';
|
|
27
|
+
const INITIAL_VERSION = 1;
|
|
28
|
+
/** Any Markdown heading of level 2 or deeper, e.g. `## Auth` / `### Tokens`. */
|
|
29
|
+
const HEADING_RE = /^(#{1,6})[ \t]+(.*?)[ \t]*$/;
|
|
30
|
+
// ── Headings ────────────────────────────────────────────────────────────────
|
|
31
|
+
/** Parse a line into `{ level, text }` when it is a Markdown ATX heading. */
|
|
32
|
+
function parseHeading(line) {
|
|
33
|
+
const match = HEADING_RE.exec(line);
|
|
34
|
+
if (!match)
|
|
35
|
+
return undefined;
|
|
36
|
+
const text = match[2] ?? '';
|
|
37
|
+
if (text.length === 0)
|
|
38
|
+
return undefined;
|
|
39
|
+
return { level: match[1].length, text };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Table of contents: the `##` headings of the body, in document order (spec §4.11).
|
|
43
|
+
* `heading` carries the full heading line (`## Auth`) so it can be passed straight back
|
|
44
|
+
* as `orbitmap doc <slug> --section "## Auth"`.
|
|
45
|
+
*/
|
|
46
|
+
export function tableOfContents(body) {
|
|
47
|
+
const entries = [];
|
|
48
|
+
for (const line of body.split(/\r?\n/)) {
|
|
49
|
+
const heading = parseHeading(line);
|
|
50
|
+
if (!heading || heading.level !== 2)
|
|
51
|
+
continue;
|
|
52
|
+
entries.push({ heading: `## ${heading.text}`, level: heading.level });
|
|
53
|
+
}
|
|
54
|
+
return entries;
|
|
55
|
+
}
|
|
56
|
+
/** Normalise a section reference (`"## Auth"`, `"Auth"`, `" auth "`) for comparison. */
|
|
57
|
+
function normaliseHeading(value) {
|
|
58
|
+
return value.trim().replace(/^#+[ \t]*/, '').trim().toLowerCase();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Extract exactly one section: the matching heading line plus everything up to the next
|
|
62
|
+
* heading of the same or a higher level. Nested sub-headings stay inside the section.
|
|
63
|
+
*/
|
|
64
|
+
export function extractSection(body, section) {
|
|
65
|
+
const wanted = normaliseHeading(section);
|
|
66
|
+
if (wanted.length === 0)
|
|
67
|
+
return undefined;
|
|
68
|
+
const lines = body.split(/\r?\n/);
|
|
69
|
+
let start = -1;
|
|
70
|
+
let level = 0;
|
|
71
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
72
|
+
const heading = parseHeading(lines[index]);
|
|
73
|
+
if (!heading)
|
|
74
|
+
continue;
|
|
75
|
+
if (normaliseHeading(heading.text) !== wanted)
|
|
76
|
+
continue;
|
|
77
|
+
start = index;
|
|
78
|
+
level = heading.level;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
if (start === -1)
|
|
82
|
+
return undefined;
|
|
83
|
+
let end = lines.length;
|
|
84
|
+
for (let index = start + 1; index < lines.length; index += 1) {
|
|
85
|
+
const heading = parseHeading(lines[index]);
|
|
86
|
+
if (heading && heading.level <= level) {
|
|
87
|
+
end = index;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return lines.slice(start, end).join('\n').replace(/\s+$/, '');
|
|
92
|
+
}
|
|
93
|
+
// ── Lookups ─────────────────────────────────────────────────────────────────
|
|
94
|
+
/**
|
|
95
|
+
* Resolve a document reference: its slug, its uuid, or a title that slugifies to an
|
|
96
|
+
* existing slug. Throws `NOT_FOUND` when nothing matches.
|
|
97
|
+
*/
|
|
98
|
+
export async function requireDocument(ctx, idOrSlug) {
|
|
99
|
+
const trimmed = idOrSlug.trim();
|
|
100
|
+
const bySlug = await ctx.store.findDocumentBySlug(trimmed);
|
|
101
|
+
if (bySlug)
|
|
102
|
+
return bySlug;
|
|
103
|
+
const all = await ctx.store.listDocuments();
|
|
104
|
+
const byId = all.find((doc) => doc.frontmatter.id === trimmed);
|
|
105
|
+
if (byId)
|
|
106
|
+
return byId;
|
|
107
|
+
const slug = slugify(trimmed);
|
|
108
|
+
const bySlugified = all.find((doc) => doc.frontmatter.slug === slug);
|
|
109
|
+
if (bySlugified)
|
|
110
|
+
return bySlugified;
|
|
111
|
+
throw new OrbitMapAPIError(`Document \`${idOrSlug}\` was not found in this workspace.`, 'NOT_FOUND', 404);
|
|
112
|
+
}
|
|
113
|
+
// ── Envelope builders (document-specific — shared ones live in ../shapes.ts) ──
|
|
114
|
+
/** One row of `GET /documents`. */
|
|
115
|
+
function documentListItem(doc) {
|
|
116
|
+
const record = doc.frontmatter;
|
|
117
|
+
return {
|
|
118
|
+
id: record.id,
|
|
119
|
+
title: record.title,
|
|
120
|
+
context: record.context ?? null,
|
|
121
|
+
slug: record.slug,
|
|
122
|
+
type: record.type,
|
|
123
|
+
version: record.version,
|
|
124
|
+
status: record.status,
|
|
125
|
+
updated_at: record.updated_at,
|
|
126
|
+
_shared: false,
|
|
127
|
+
// Local documents are always workspace-scoped (§4.1) — same value ../shapes.ts
|
|
128
|
+
// reports in the context envelope; keep the two consistent.
|
|
129
|
+
_workspace: true,
|
|
130
|
+
sections_count: countSections(doc.body),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/** The `data` block of `GET /documents/{id}` — the fixture shape, content excluded. */
|
|
134
|
+
function documentShowData(ctx, doc) {
|
|
135
|
+
const record = doc.frontmatter;
|
|
136
|
+
return {
|
|
137
|
+
id: record.id,
|
|
138
|
+
workspace_id: ctx.workspace.workspace_id,
|
|
139
|
+
areas: Array.isArray(record.areas) ? [...record.areas] : [],
|
|
140
|
+
title: record.title,
|
|
141
|
+
context: record.context ?? null,
|
|
142
|
+
slug: record.slug,
|
|
143
|
+
type: record.type,
|
|
144
|
+
version: record.version,
|
|
145
|
+
status: record.status,
|
|
146
|
+
source_path: record.source_path ?? null,
|
|
147
|
+
created_at: record.created_at,
|
|
148
|
+
updated_at: record.updated_at,
|
|
149
|
+
_shared: false,
|
|
150
|
+
table_of_contents: tableOfContents(doc.body),
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
// ── Adapter surface ─────────────────────────────────────────────────────────
|
|
154
|
+
/**
|
|
155
|
+
* `GET /documents` — every document in `documents/`, with the computed `sections_count`
|
|
156
|
+
* and the `context` line the agent uses to decide what to read.
|
|
157
|
+
*
|
|
158
|
+
* `type` filters on the document type, `search` matches title, slug, context and body
|
|
159
|
+
* case-insensitively. `areaId` is ignored: local documents are workspace-scoped (§4.1).
|
|
160
|
+
*/
|
|
161
|
+
export async function getDocuments(ctx, options) {
|
|
162
|
+
const type = options?.type ? assertDocumentType(options.type) : undefined;
|
|
163
|
+
const search = options?.search?.trim().toLowerCase();
|
|
164
|
+
const documents = await ctx.store.listDocuments();
|
|
165
|
+
const data = documents
|
|
166
|
+
.filter((doc) => (type ? doc.frontmatter.type === type : true))
|
|
167
|
+
.filter((doc) => {
|
|
168
|
+
if (!search)
|
|
169
|
+
return true;
|
|
170
|
+
const haystack = [
|
|
171
|
+
doc.frontmatter.title,
|
|
172
|
+
doc.frontmatter.slug,
|
|
173
|
+
doc.frontmatter.context ?? '',
|
|
174
|
+
doc.body,
|
|
175
|
+
]
|
|
176
|
+
.join('\n')
|
|
177
|
+
.toLowerCase();
|
|
178
|
+
return haystack.includes(search);
|
|
179
|
+
})
|
|
180
|
+
.map(documentListItem);
|
|
181
|
+
return { data, meta: { count: data.length } };
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* `GET /documents/{id}` in its three flavours:
|
|
185
|
+
*
|
|
186
|
+
* - default — context + computed table of contents (cheap);
|
|
187
|
+
* - `options.section` — the requested section only, in `content`;
|
|
188
|
+
* - `mode: 'file'` / `options.full` — the full body in `content`, plus `file_path`, the
|
|
189
|
+
* absolute path of the Markdown file on disk (spec §2.2 — local mode has no URLs).
|
|
190
|
+
*/
|
|
191
|
+
export async function getDocument(ctx, idOrSlug, mode, options) {
|
|
192
|
+
const doc = await requireDocument(ctx, idOrSlug);
|
|
193
|
+
const data = documentShowData(ctx, doc);
|
|
194
|
+
if (options?.section !== undefined) {
|
|
195
|
+
const content = extractSection(doc.body, options.section);
|
|
196
|
+
if (content === undefined) {
|
|
197
|
+
throw new OrbitMapAPIError(`Section "${options.section}" was not found in document \`${doc.frontmatter.slug}\`.`, 'NOT_FOUND', 404, {
|
|
198
|
+
available_sections: tableOfContents(doc.body).map((entry) => entry.heading),
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
return { data: { ...data, content } };
|
|
202
|
+
}
|
|
203
|
+
if (mode === 'file' || mode === 'inline' || options?.full) {
|
|
204
|
+
return { data: { ...data, content: doc.body, file_path: doc.path } };
|
|
205
|
+
}
|
|
206
|
+
return { data };
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* `POST /documents` — write `documents/<slug>.md` in the §4.11 format: slug derived from
|
|
210
|
+
* the title (unique per workspace), `version: 1`, `status: draft`.
|
|
211
|
+
*/
|
|
212
|
+
export async function importDocument(ctx, data) {
|
|
213
|
+
const title = data.title?.trim() ?? '';
|
|
214
|
+
const type = assertDocumentType(data.type);
|
|
215
|
+
const status = assertDocumentStatus(INITIAL_STATUS);
|
|
216
|
+
const slug = slugify(title);
|
|
217
|
+
const existing = await ctx.store.listDocuments();
|
|
218
|
+
assertUniqueDocumentSlug(slug, existing.map((doc) => doc.frontmatter.slug));
|
|
219
|
+
const timestamp = nowIso();
|
|
220
|
+
const record = {
|
|
221
|
+
id: newId(),
|
|
222
|
+
title,
|
|
223
|
+
slug,
|
|
224
|
+
type,
|
|
225
|
+
version: INITIAL_VERSION,
|
|
226
|
+
status: status ?? INITIAL_STATUS,
|
|
227
|
+
context: data.context ?? null,
|
|
228
|
+
source_path: data.source_path ?? null,
|
|
229
|
+
created_by: LOCAL_CREATED_BY,
|
|
230
|
+
created_at: timestamp,
|
|
231
|
+
updated_at: timestamp,
|
|
232
|
+
};
|
|
233
|
+
await ctx.store.writeDocument(record, data.content ?? '');
|
|
234
|
+
return { data: { document_id: record.id, slug: record.slug, imported: true } };
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* `PUT /documents/{id}` — replace the body, bump `version` and `updated_at`. Unknown
|
|
238
|
+
* frontmatter keys are preserved (read → modify → write). `changelog` is accepted for
|
|
239
|
+
* API parity but not persisted: the PoC keeps no version history (spec §4.11).
|
|
240
|
+
*/
|
|
241
|
+
export async function updateDocument(ctx, idOrSlug, content, _changelog) {
|
|
242
|
+
const doc = await requireDocument(ctx, idOrSlug);
|
|
243
|
+
const record = {
|
|
244
|
+
...doc.frontmatter,
|
|
245
|
+
version: (Number(doc.frontmatter.version) || 0) + 1,
|
|
246
|
+
updated_at: nowIso(),
|
|
247
|
+
};
|
|
248
|
+
await ctx.store.writeDocument(record, content ?? '');
|
|
249
|
+
return { data: { document_id: record.id, version: record.version, updated: true } };
|
|
250
|
+
}
|
|
251
|
+
//# sourceMappingURL=documents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documents.js","sourceRoot":"","sources":["../../../../src/adapters/local/entities/documents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAqB,MAAM,eAAe,CAAC;AAC3E,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG9C,mFAAmF;AACnF,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