orbitmap 0.4.2 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/README.md +112 -18
  2. package/dist/adapters/cloud.d.ts +63 -21
  3. package/dist/adapters/cloud.js +108 -29
  4. package/dist/adapters/cloud.js.map +1 -1
  5. package/dist/adapters/factory.d.ts +3 -0
  6. package/dist/adapters/factory.js +8 -1
  7. package/dist/adapters/factory.js.map +1 -1
  8. package/dist/adapters/local/adapter.d.ts +17 -20
  9. package/dist/adapters/local/adapter.js +28 -21
  10. package/dist/adapters/local/adapter.js.map +1 -1
  11. package/dist/adapters/local/context.d.ts +1 -1
  12. package/dist/adapters/local/context.js +10 -2
  13. package/dist/adapters/local/context.js.map +1 -1
  14. package/dist/adapters/local/entities/planning.d.ts +5 -1
  15. package/dist/adapters/local/entities/planning.js +16 -3
  16. package/dist/adapters/local/entities/planning.js.map +1 -1
  17. package/dist/adapters/local/entities/tasks.d.ts +9 -1
  18. package/dist/adapters/local/entities/tasks.js +47 -5
  19. package/dist/adapters/local/entities/tasks.js.map +1 -1
  20. package/dist/adapters/local/entities/work-items.d.ts +14 -30
  21. package/dist/adapters/local/entities/work-items.js +63 -47
  22. package/dist/adapters/local/entities/work-items.js.map +1 -1
  23. package/dist/adapters/local/rules.d.ts +4 -4
  24. package/dist/adapters/local/rules.js +4 -19
  25. package/dist/adapters/local/rules.js.map +1 -1
  26. package/dist/adapters/local/shapes.d.ts +27 -7
  27. package/dist/adapters/local/shapes.js +41 -5
  28. package/dist/adapters/local/shapes.js.map +1 -1
  29. package/dist/adapters/local/store.d.ts +55 -6
  30. package/dist/adapters/local/store.js +122 -8
  31. package/dist/adapters/local/store.js.map +1 -1
  32. package/dist/adapters/local/types.d.ts +11 -2
  33. package/dist/adapters/local/types.js +9 -2
  34. package/dist/adapters/local/types.js.map +1 -1
  35. package/dist/adapters/types.d.ts +30 -20
  36. package/dist/agent-instructions.d.ts +43 -12
  37. package/dist/agent-instructions.js +1133 -170
  38. package/dist/agent-instructions.js.map +1 -1
  39. package/dist/area-directories.d.ts +75 -0
  40. package/dist/area-directories.js +162 -0
  41. package/dist/area-directories.js.map +1 -0
  42. package/dist/area-grouping.d.ts +55 -0
  43. package/dist/area-grouping.js +72 -0
  44. package/dist/area-grouping.js.map +1 -0
  45. package/dist/commands/areas.js +30 -2
  46. package/dist/commands/areas.js.map +1 -1
  47. package/dist/commands/assign.d.ts +1 -0
  48. package/dist/commands/assign.js +2 -0
  49. package/dist/commands/assign.js.map +1 -1
  50. package/dist/commands/context.d.ts +95 -0
  51. package/dist/commands/context.js +104 -2
  52. package/dist/commands/context.js.map +1 -1
  53. package/dist/commands/create.d.ts +1 -0
  54. package/dist/commands/create.js +19 -14
  55. package/dist/commands/create.js.map +1 -1
  56. package/dist/commands/dep.js +5 -8
  57. package/dist/commands/dep.js.map +1 -1
  58. package/dist/commands/doc-import.d.ts +1 -0
  59. package/dist/commands/doc-import.js +8 -26
  60. package/dist/commands/doc-import.js.map +1 -1
  61. package/dist/commands/doc-patch.js +16 -52
  62. package/dist/commands/doc-patch.js.map +1 -1
  63. package/dist/commands/doc-share.js +4 -0
  64. package/dist/commands/doc-share.js.map +1 -1
  65. package/dist/commands/doc-update.js +4 -8
  66. package/dist/commands/doc-update.js.map +1 -1
  67. package/dist/commands/doc.js +7 -12
  68. package/dist/commands/doc.js.map +1 -1
  69. package/dist/commands/docs-cache.js +23 -10
  70. package/dist/commands/docs-cache.js.map +1 -1
  71. package/dist/commands/docs.js +29 -10
  72. package/dist/commands/docs.js.map +1 -1
  73. package/dist/commands/get.js +8 -10
  74. package/dist/commands/get.js.map +1 -1
  75. package/dist/commands/ideas.d.ts +3 -1
  76. package/dist/commands/ideas.js +26 -49
  77. package/dist/commands/ideas.js.map +1 -1
  78. package/dist/commands/init.d.ts +24 -1
  79. package/dist/commands/init.js +0 -0
  80. package/dist/commands/init.js.map +1 -1
  81. package/dist/commands/intent.d.ts +16 -0
  82. package/dist/commands/intent.js +61 -18
  83. package/dist/commands/intent.js.map +1 -1
  84. package/dist/commands/issues.d.ts +3 -1
  85. package/dist/commands/issues.js +47 -72
  86. package/dist/commands/issues.js.map +1 -1
  87. package/dist/commands/log.d.ts +14 -2
  88. package/dist/commands/log.js +35 -20
  89. package/dist/commands/log.js.map +1 -1
  90. package/dist/commands/mission.d.ts +8 -0
  91. package/dist/commands/mission.js +58 -18
  92. package/dist/commands/mission.js.map +1 -1
  93. package/dist/commands/orbit.d.ts +7 -1
  94. package/dist/commands/orbit.js +13 -24
  95. package/dist/commands/orbit.js.map +1 -1
  96. package/dist/commands/setup-agent.d.ts +97 -4
  97. package/dist/commands/setup-agent.js +273 -40
  98. package/dist/commands/setup-agent.js.map +1 -1
  99. package/dist/commands/setup-mcp.d.ts +2 -0
  100. package/dist/commands/setup-mcp.js +17 -40
  101. package/dist/commands/setup-mcp.js.map +1 -1
  102. package/dist/commands/start.d.ts +43 -0
  103. package/dist/commands/start.js +158 -3
  104. package/dist/commands/start.js.map +1 -1
  105. package/dist/commands/status.d.ts +1 -0
  106. package/dist/commands/status.js +5 -15
  107. package/dist/commands/status.js.map +1 -1
  108. package/dist/commands/subtask.d.ts +1 -0
  109. package/dist/commands/subtask.js +9 -2
  110. package/dist/commands/subtask.js.map +1 -1
  111. package/dist/commands/task-edit-content.js +4 -8
  112. package/dist/commands/task-edit-content.js.map +1 -1
  113. package/dist/commands/task.d.ts +7 -0
  114. package/dist/commands/task.js +5 -2
  115. package/dist/commands/task.js.map +1 -1
  116. package/dist/commands/tasks.d.ts +35 -0
  117. package/dist/commands/tasks.js +45 -9
  118. package/dist/commands/tasks.js.map +1 -1
  119. package/dist/commands/vibes.d.ts +3 -1
  120. package/dist/commands/vibes.js +41 -31
  121. package/dist/commands/vibes.js.map +1 -1
  122. package/dist/config.d.ts +11 -0
  123. package/dist/config.js +14 -1
  124. package/dist/config.js.map +1 -1
  125. package/dist/doc-cache.d.ts +74 -5
  126. package/dist/doc-cache.js +106 -22
  127. package/dist/doc-cache.js.map +1 -1
  128. package/dist/enums.d.ts +26 -0
  129. package/dist/enums.js +53 -0
  130. package/dist/enums.js.map +1 -0
  131. package/dist/errors.d.ts +67 -0
  132. package/dist/errors.js +82 -0
  133. package/dist/errors.js.map +1 -1
  134. package/dist/index.js +169 -60
  135. package/dist/index.js.map +1 -1
  136. package/dist/mcp-config.d.ts +42 -1
  137. package/dist/mcp-config.js +82 -2
  138. package/dist/mcp-config.js.map +1 -1
  139. package/dist/oauth.js +10 -10
  140. package/dist/output.d.ts +12 -0
  141. package/dist/output.js +39 -1
  142. package/dist/output.js.map +1 -1
  143. package/dist/paths.d.ts +40 -0
  144. package/dist/paths.js +174 -9
  145. package/dist/paths.js.map +1 -1
  146. package/dist/project-config.d.ts +42 -1
  147. package/dist/project-config.js +51 -0
  148. package/dist/project-config.js.map +1 -1
  149. package/dist/work-log.d.ts +104 -0
  150. package/dist/work-log.js +181 -0
  151. package/dist/work-log.js.map +1 -0
  152. package/dist/workspace-resolve.d.ts +179 -9
  153. package/dist/workspace-resolve.js +288 -20
  154. package/dist/workspace-resolve.js.map +1 -1
  155. package/dist/write-target.d.ts +56 -0
  156. package/dist/write-target.js +170 -0
  157. package/dist/write-target.js.map +1 -0
  158. package/package.json +3 -2
  159. package/dist/commands/create-project.d.ts +0 -6
  160. package/dist/commands/create-project.js +0 -28
  161. package/dist/commands/create-project.js.map +0 -1
  162. package/dist/commands/projects.d.ts +0 -3
  163. package/dist/commands/projects.js +0 -28
  164. package/dist/commands/projects.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"agent-instructions.js","sourceRoot":"","sources":["../src/agent-instructions.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,2DAA2D;AAC3D,oFAAoF;AACpF,oFAAoF;AACpF,oFAAoF;AACpF,+EAA+E;AAC/E,+EAA+E;AAC/E,uEAAuE;AACvE,iFAAiF;AACjF,oFAAoF;AACpF,+EAA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;QACxB,WAAW,EAAE,yBAAyB;QACtC,IAAI,EAAE,kBAAkB;KACzB;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,WAAW,EAAE,0BAA0B;QACvC,IAAI,EAAE,mBAAmB;KAC1B;IACD;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,sBAAsB;QACnC,IAAI,EAAE,eAAe;KACtB;CACO,CAAC;AAEX,kFAAkF;AAElF,qFAAqF;AACrF,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;oDAUoB,CAAC;AAErD,sFAAsF;AACtF,wCAAwC;AACxC,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;oDAUmB,CAAC;AAErD,kFAAkF;AAElF,+DAA+D;AAC/D,MAAM,UAAU,cAAc,CAAC,KAAe;IAC5C,OAAO,GAAG,KAAK,CAAC,WAAW,OAAO,KAAK,CAAC,IAAI,IAAI,CAAC;AACnD,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,eAAe;IAC7B,OAAO,GAAG,YAAY,KAAK,gBAAgB,KAAK,UAAU,EAAE,CAAC;AAC/D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACrE,OAAO,GAAG,YAAY,KAAK,iBAAiB,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;AAC7E,CAAC"}
1
+ {"version":3,"file":"agent-instructions.js","sourceRoot":"","sources":["../src/agent-instructions.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,oFAAoF;AACpF,oFAAoF;AACpF,wEAAwE;AACxE,EAAE;AACF,2DAA2D;AAC3D,oFAAoF;AACpF,oFAAoF;AACpF,oFAAoF;AACpF,+EAA+E;AAC/E,qEAAqE;AACrE,6EAA6E;AAC7E,oF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AAC,KAAe;IAC5C,OAAO,GAAG,KAAK,CAAC,WAAW,OAAO,KAAK,CAAC,IAAI,IAAI,CAAC;AACnD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,0BAA0B,GACrC,uFAAuF;IACvF,uFAAuF;IACvF,sFAAsF;IACtF,0EAA0E,CAAC;AAE7E;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,QAA4B,MAAM;IAChE,MAAM,IAAI,GACR,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,gBAAgB,KAAK,0BAA0B,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC;IAChG,OAAO,GAAG,YAAY,KAAK,IAAI,KAAK,UAAU,EAAE,CAAC;AACnD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACrE,OAAO,GAAG,YAAY,KAAK,iBAAiB,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Which directory holds which area's code — the guessing half of the workspace-first
3
+ * `orbitmap init` (schema v2).
4
+ *
5
+ * A workspace groups several areas, and on this machine each of them is (usually) a
6
+ * directory: either a subdirectory of an umbrella checkout, or the repository the user is
7
+ * standing in. Nothing on the server records that mapping — it is per machine — so `init`
8
+ * has to infer it and then write it down (`config.json` `areas` for in-tree directories,
9
+ * `link.json` `areas` for the rest).
10
+ *
11
+ * Three signals, in decreasing order of confidence, all of them cheap and offline:
12
+ *
13
+ * 1. **`name`** — the directory is literally named after the area slug. Unambiguous.
14
+ * 2. **`git-remote`** — the directory's `origin` remote is the area's `git_url`. The
15
+ * strongest signal there is (an area *is* a repository in the data model), and the only
16
+ * one that survives a renamed checkout.
17
+ * 3. **`slugified-name`** — slugifying the directory name yields the slug (`My App` →
18
+ * `my-app`), i.e. the same rule the server used to make the slug in the first place.
19
+ *
20
+ * The git remote is read from `.git/config` rather than by spawning `git`: the CLI's tests
21
+ * are offline and process-free by policy, a subprocess per candidate directory is the
22
+ * slowest thing `init` could possibly do, and the file format has been stable for two
23
+ * decades. Anything not matched by these three is asked about (or skipped) — never guessed.
24
+ */
25
+ /** As much of an area as the mapping needs; satisfied by `GET /areas` entries. */
26
+ export interface AreaLike {
27
+ slug: string;
28
+ name?: string;
29
+ /** Repository URL recorded on the area, when the provider returns one. */
30
+ git_url?: string | null;
31
+ }
32
+ /** Which signal produced a directory ↔ area pairing. */
33
+ export type AreaMatchKind = 'name' | 'git-remote' | 'slugified-name';
34
+ /** One inferred pairing. */
35
+ export interface AreaDirectoryMatch<T extends AreaLike = AreaLike> {
36
+ area: T;
37
+ /** Absolute directory. */
38
+ dir: string;
39
+ how: AreaMatchKind;
40
+ }
41
+ /**
42
+ * Immediate subdirectories of `root` that could plausibly be an area checkout — absolute
43
+ * paths, sorted, dot-directories and the usual build/dependency noise removed.
44
+ *
45
+ * Deliberately one level deep: deeper nesting is a real layout but scanning for it turns a
46
+ * setup command into a filesystem crawl, and the manual answer covers it in one line.
47
+ */
48
+ export declare function listCandidateDirectories(root: string): string[];
49
+ /**
50
+ * Comparable form of a git URL: scheme, credentials, the `.git` suffix and the
51
+ * `git@host:path` / `https://host/path` spelling difference all removed, so the two ways of
52
+ * writing the same repository compare equal.
53
+ */
54
+ export declare function normalizeGitUrl(url: string): string;
55
+ /**
56
+ * The `origin` remote URL recorded in `dir`'s git config, or `undefined` when `dir` is not a
57
+ * checkout (or has no origin). Handles the `.git`-as-a-file form that worktrees and
58
+ * submodules use.
59
+ */
60
+ export declare function readGitRemoteUrl(dir: string): string | undefined;
61
+ /** True when `dir` is the checkout of `area`, by any of the three signals. */
62
+ export declare function matchDirectoryToArea(dir: string, area: AreaLike): AreaMatchKind | undefined;
63
+ /**
64
+ * Guess a directory under `root` for each area, and report which areas got none.
65
+ *
66
+ * One directory is never handed to two areas: the candidates are consumed as they match, in
67
+ * area order, so a `name` hit for one area cannot be stolen by a `slugified-name` hit for
68
+ * another.
69
+ */
70
+ export declare function detectAreaDirectories<T extends AreaLike>(root: string, areas: T[], candidates?: string[]): {
71
+ matched: Array<AreaDirectoryMatch<T>>;
72
+ unmatched: T[];
73
+ };
74
+ /** The inverse question: standing in `dir`, which of these areas is it? */
75
+ export declare function detectAreaForDirectory<T extends AreaLike>(dir: string, areas: T[]): AreaDirectoryMatch<T> | undefined;
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Which directory holds which area's code — the guessing half of the workspace-first
3
+ * `orbitmap init` (schema v2).
4
+ *
5
+ * A workspace groups several areas, and on this machine each of them is (usually) a
6
+ * directory: either a subdirectory of an umbrella checkout, or the repository the user is
7
+ * standing in. Nothing on the server records that mapping — it is per machine — so `init`
8
+ * has to infer it and then write it down (`config.json` `areas` for in-tree directories,
9
+ * `link.json` `areas` for the rest).
10
+ *
11
+ * Three signals, in decreasing order of confidence, all of them cheap and offline:
12
+ *
13
+ * 1. **`name`** — the directory is literally named after the area slug. Unambiguous.
14
+ * 2. **`git-remote`** — the directory's `origin` remote is the area's `git_url`. The
15
+ * strongest signal there is (an area *is* a repository in the data model), and the only
16
+ * one that survives a renamed checkout.
17
+ * 3. **`slugified-name`** — slugifying the directory name yields the slug (`My App` →
18
+ * `my-app`), i.e. the same rule the server used to make the slug in the first place.
19
+ *
20
+ * The git remote is read from `.git/config` rather than by spawning `git`: the CLI's tests
21
+ * are offline and process-free by policy, a subprocess per candidate directory is the
22
+ * slowest thing `init` could possibly do, and the file format has been stable for two
23
+ * decades. Anything not matched by these three is asked about (or skipped) — never guessed.
24
+ */
25
+ import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
26
+ import { basename, isAbsolute, join, resolve } from 'node:path';
27
+ import { slugify } from './adapters/local/store.js';
28
+ /** Directory names never worth scanning as an area checkout. */
29
+ const SKIP_DIRS = new Set([
30
+ 'node_modules',
31
+ 'vendor',
32
+ 'dist',
33
+ 'build',
34
+ 'out',
35
+ 'target',
36
+ 'coverage',
37
+ 'tmp',
38
+ '__pycache__',
39
+ ]);
40
+ /**
41
+ * Immediate subdirectories of `root` that could plausibly be an area checkout — absolute
42
+ * paths, sorted, dot-directories and the usual build/dependency noise removed.
43
+ *
44
+ * Deliberately one level deep: deeper nesting is a real layout but scanning for it turns a
45
+ * setup command into a filesystem crawl, and the manual answer covers it in one line.
46
+ */
47
+ export function listCandidateDirectories(root) {
48
+ let entries;
49
+ try {
50
+ entries = readdirSync(resolve(root), { withFileTypes: true });
51
+ }
52
+ catch {
53
+ return [];
54
+ }
55
+ return entries
56
+ .filter((entry) => entry.isDirectory())
57
+ .map((entry) => entry.name)
58
+ .filter((name) => !name.startsWith('.') && !SKIP_DIRS.has(name.toLowerCase()))
59
+ .sort()
60
+ .map((name) => join(resolve(root), name));
61
+ }
62
+ /**
63
+ * Comparable form of a git URL: scheme, credentials, the `.git` suffix and the
64
+ * `git@host:path` / `https://host/path` spelling difference all removed, so the two ways of
65
+ * writing the same repository compare equal.
66
+ */
67
+ export function normalizeGitUrl(url) {
68
+ let out = url.trim().toLowerCase();
69
+ if (!out)
70
+ return '';
71
+ out = out.replace(/^git\+/, '');
72
+ out = out.replace(/^[a-z][a-z0-9+.-]*:\/\//, '');
73
+ out = out.replace(/^[^/@]+@/, '');
74
+ // scp-style `host:org/repo` → `host/org/repo`; a `:port` (digits) is left alone.
75
+ out = out.replace(/^([^/:]+):(?!\d)/, '$1/');
76
+ out = out.replace(/\.git$/, '');
77
+ return out.replace(/\/+$/, '');
78
+ }
79
+ /**
80
+ * The `origin` remote URL recorded in `dir`'s git config, or `undefined` when `dir` is not a
81
+ * checkout (or has no origin). Handles the `.git`-as-a-file form that worktrees and
82
+ * submodules use.
83
+ */
84
+ export function readGitRemoteUrl(dir) {
85
+ const gitPath = join(resolve(dir), '.git');
86
+ if (!existsSync(gitPath))
87
+ return undefined;
88
+ let configFile = join(gitPath, 'config');
89
+ try {
90
+ if (statSync(gitPath).isFile()) {
91
+ const pointer = readFileSync(gitPath, 'utf-8').match(/^gitdir:\s*(.+)$/m)?.[1]?.trim();
92
+ if (!pointer)
93
+ return undefined;
94
+ configFile = join(isAbsolute(pointer) ? pointer : resolve(dir, pointer), 'config');
95
+ }
96
+ if (!existsSync(configFile))
97
+ return undefined;
98
+ const contents = readFileSync(configFile, 'utf-8');
99
+ // Only the `[remote "origin"]` section: any other remote (a fork, a mirror) is a
100
+ // different repository as far as identifying an area goes.
101
+ const section = contents.split(/^\[/m).find((part) => /^remote\s+"origin"\]/.test(part));
102
+ return section?.match(/^\s*url\s*=\s*(.+)$/m)?.[1]?.trim() || undefined;
103
+ }
104
+ catch {
105
+ return undefined;
106
+ }
107
+ }
108
+ /** True when `dir` is the checkout of `area`, by any of the three signals. */
109
+ export function matchDirectoryToArea(dir, area) {
110
+ const name = basename(resolve(dir));
111
+ if (name === area.slug)
112
+ return 'name';
113
+ if (area.git_url) {
114
+ const remote = readGitRemoteUrl(dir);
115
+ if (remote && normalizeGitUrl(remote) === normalizeGitUrl(area.git_url))
116
+ return 'git-remote';
117
+ }
118
+ if (slugify(name) === area.slug)
119
+ return 'slugified-name';
120
+ return undefined;
121
+ }
122
+ /**
123
+ * Guess a directory under `root` for each area, and report which areas got none.
124
+ *
125
+ * One directory is never handed to two areas: the candidates are consumed as they match, in
126
+ * area order, so a `name` hit for one area cannot be stolen by a `slugified-name` hit for
127
+ * another.
128
+ */
129
+ export function detectAreaDirectories(root, areas, candidates = listCandidateDirectories(root)) {
130
+ const remaining = [...candidates];
131
+ const matched = [];
132
+ const unmatched = [];
133
+ for (const area of areas) {
134
+ // The signals are tried in confidence order across *all* remaining candidates, so a
135
+ // weak match on an early directory never beats a strong one further down the list.
136
+ let hit;
137
+ for (const how of ['name', 'git-remote', 'slugified-name']) {
138
+ const dir = remaining.find((candidate) => matchDirectoryToArea(candidate, area) === how);
139
+ if (dir) {
140
+ hit = { dir, how };
141
+ break;
142
+ }
143
+ }
144
+ if (!hit) {
145
+ unmatched.push(area);
146
+ continue;
147
+ }
148
+ remaining.splice(remaining.indexOf(hit.dir), 1);
149
+ matched.push({ area, dir: hit.dir, how: hit.how });
150
+ }
151
+ return { matched, unmatched };
152
+ }
153
+ /** The inverse question: standing in `dir`, which of these areas is it? */
154
+ export function detectAreaForDirectory(dir, areas) {
155
+ for (const how of ['name', 'git-remote', 'slugified-name']) {
156
+ const area = areas.find((candidate) => matchDirectoryToArea(dir, candidate) === how);
157
+ if (area)
158
+ return { area, dir: resolve(dir), how };
159
+ }
160
+ return undefined;
161
+ }
162
+ //# sourceMappingURL=area-directories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"area-directories.js","sourceRoot":"","sources":["../src/area-directories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAqBpD,gEAAgE;AAChE,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC;IACxB,cAAc;IACd,QAAQ;IACR,MAAM;IACN,OAAO;IACP,KAAK;IACL,QAAQ;IACR,UAAU;IACV,KAAK;IACL,aAAa;CACd,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAAY;IACnD,IAAI,OAAO,CAAC;IACZ,IAAI,CAAC;QACH,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,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M,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QAChD,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AAChC,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,sBAAsB,CACpC,GAAW,EACX,KAAU;IAEV,KAAK,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,gBAAgB,CAAU,EAAE,CAAC;QACpE,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,oBAAoB,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC;QACrF,IAAI,IAAI;YAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC;IACpD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Grouping list rows by area, for the workspace-scoped listings (TS-adanc8).
3
+ *
4
+ * `orbitmap tasks` solved this first: in workspace scope a flat table of rows from several
5
+ * areas is unreadable and, worse, unactionable — nothing tells you which `--area` a row
6
+ * needs. It grouped them under an `── Name (slug) ──` heading. Issues, ideas, vibes and
7
+ * documents have the same problem and now share this implementation instead of growing four
8
+ * more copies of the fold.
9
+ *
10
+ * **Degrades on purpose.** The `area` block only reaches the issue/idea payloads with
11
+ * TS-95h9rj (web-app); until then those rows carry no area at all. Rather than print an
12
+ * empty column or a UUID heading nobody can use, {@link groupByArea} reports
13
+ * `grouped: false` when NO row names an area, and callers render exactly the flat table they
14
+ * rendered before. The moment the field appears the grouping lights up with no CLI change.
15
+ *
16
+ * A row with an `area` and a row without it can coexist (an area-less issue is legal — the
17
+ * column is nullable since s2e5t1), so "some rows have it" still groups, with the area-less
18
+ * rows collected under one `(no area)` heading.
19
+ */
20
+ /** The `area` block a workspace-scoped row carries: the same three fields everywhere. */
21
+ export interface RowArea {
22
+ id?: string | null;
23
+ slug?: string | null;
24
+ name?: string | null;
25
+ }
26
+ /** The only thing {@link groupByArea} needs of a row. */
27
+ export interface AreaScopedRow {
28
+ area?: RowArea | null;
29
+ }
30
+ export interface AreaGroup<T> {
31
+ /** Heading text: `Name (slug)`, or `(no area)` for the area-less bucket. */
32
+ label: string;
33
+ slug: string | null;
34
+ rows: T[];
35
+ }
36
+ export interface AreaGrouping<T> {
37
+ /**
38
+ * `false` when not one row named an area — the payload predates TS-95h9rj, or the listing
39
+ * is area-scoped and every row trivially belongs to the requested area. Callers must fall
40
+ * back to a flat table; `groups` then holds a single unlabelled group with every row.
41
+ */
42
+ grouped: boolean;
43
+ groups: Array<AreaGroup<T>>;
44
+ }
45
+ /**
46
+ * Fold rows into one group per area, in ARRIVAL order — the server already orders by area,
47
+ * so this preserves whatever ordering it applied inside an area rather than imposing one.
48
+ */
49
+ export declare function groupByArea<T extends AreaScopedRow>(rows: T[]): AreaGrouping<T>;
50
+ /**
51
+ * Render a grouped listing: one table per area under a heading, or the plain table when the
52
+ * rows carry no area. `renderTable` stays the caller's business — every list has its own
53
+ * columns — so this owns only the headings and the spacing between them.
54
+ */
55
+ export declare function printAreaGroups<T extends AreaScopedRow>(rows: T[], renderTable: (rows: T[]) => string, log?: (line: string) => void): boolean;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Grouping list rows by area, for the workspace-scoped listings (TS-adanc8).
3
+ *
4
+ * `orbitmap tasks` solved this first: in workspace scope a flat table of rows from several
5
+ * areas is unreadable and, worse, unactionable — nothing tells you which `--area` a row
6
+ * needs. It grouped them under an `── Name (slug) ──` heading. Issues, ideas, vibes and
7
+ * documents have the same problem and now share this implementation instead of growing four
8
+ * more copies of the fold.
9
+ *
10
+ * **Degrades on purpose.** The `area` block only reaches the issue/idea payloads with
11
+ * TS-95h9rj (web-app); until then those rows carry no area at all. Rather than print an
12
+ * empty column or a UUID heading nobody can use, {@link groupByArea} reports
13
+ * `grouped: false` when NO row names an area, and callers render exactly the flat table they
14
+ * rendered before. The moment the field appears the grouping lights up with no CLI change.
15
+ *
16
+ * A row with an `area` and a row without it can coexist (an area-less issue is legal — the
17
+ * column is nullable since s2e5t1), so "some rows have it" still groups, with the area-less
18
+ * rows collected under one `(no area)` heading.
19
+ */
20
+ /** True when the block carries something a human can read, not just an id. */
21
+ function isNamed(area) {
22
+ return Boolean(area && (area.slug || area.name));
23
+ }
24
+ /**
25
+ * Fold rows into one group per area, in ARRIVAL order — the server already orders by area,
26
+ * so this preserves whatever ordering it applied inside an area rather than imposing one.
27
+ */
28
+ export function groupByArea(rows) {
29
+ // An id-only `area` block is not enough: a heading reading `── 019fba02-… ──` is noise,
30
+ // and it is exactly what an unfinished provider-side rollout would produce.
31
+ if (!rows.some((row) => isNamed(row.area))) {
32
+ return { grouped: false, groups: [{ label: '', slug: null, rows: [...rows] }] };
33
+ }
34
+ const groups = [];
35
+ const byKey = new Map();
36
+ for (const row of rows) {
37
+ const area = isNamed(row.area) ? row.area : null;
38
+ const key = area?.slug ?? area?.id ?? '';
39
+ let group = byKey.get(key);
40
+ if (!group) {
41
+ group = {
42
+ label: area ? (area.slug ? `${area.name ?? area.slug} (${area.slug})` : `${area.name}`) : '(no area)',
43
+ slug: area?.slug ?? null,
44
+ rows: [],
45
+ };
46
+ byKey.set(key, group);
47
+ groups.push(group);
48
+ }
49
+ group.rows.push(row);
50
+ }
51
+ return { grouped: true, groups };
52
+ }
53
+ /**
54
+ * Render a grouped listing: one table per area under a heading, or the plain table when the
55
+ * rows carry no area. `renderTable` stays the caller's business — every list has its own
56
+ * columns — so this owns only the headings and the spacing between them.
57
+ */
58
+ export function printAreaGroups(rows, renderTable, log = console.log) {
59
+ const { grouped, groups } = groupByArea(rows);
60
+ if (!grouped) {
61
+ log(renderTable(rows));
62
+ return false;
63
+ }
64
+ groups.forEach((group, index) => {
65
+ if (index > 0)
66
+ log('');
67
+ log(`── ${group.label} (${group.rows.length}) ──`);
68
+ log(renderTable(group.rows));
69
+ });
70
+ return true;
71
+ }
72
+ //# sourceMappingURL=area-grouping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"area-grouping.js","sourceRoot":"","sources":["../src/area-grouping.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AA+BH,8EAA8E;AAC9E,SAAS,OAAO,CAAC,IAAgC;IAC/C,OAAO,OAAO,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACnD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAA0B,IAAS;IAC5D,wFAAwF;IACxF,4EAA4E;IAC5E,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QAC3C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;IAClF,CAAC;IAED,MAAM,MAAM,GAAwB,EAAE,CAAC;IACvC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAwB,CAAC;IAE9C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QACjD,MAAM,GAAG,GAAG,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC;Q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;QACnD,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,5 +1,18 @@
1
+ /**
2
+ * `orbitmap areas` — the areas this agent can reach.
3
+ *
4
+ * The last column used to be headed "Current" with a bare `*`, which reads as user state
5
+ * ("this is where I am working"). It is not: it is whichever area the resolution ladder
6
+ * happens to produce from the current directory, i.e. a technical default for fetching
7
+ * context (issue IS-vse335). It is now headed **"Resolves to"** and annotated with the
8
+ * rung that produced it, so the difference between "my project's config says so" and
9
+ * "a machine-wide leftover says so" is visible at a glance.
10
+ */
1
11
  import { createAdapter } from '../adapters/factory.js';
2
12
  import { formatOutput, printError, formatTable } from '../output.js';
13
+ import { loadConfig } from '../config.js';
14
+ import { resolveArea } from '../workspace-resolve.js';
15
+ import { isStrongAreaSource } from '../write-target.js';
3
16
  export async function areasCommand(options) {
4
17
  try {
5
18
  const client = await createAdapter();
@@ -13,17 +26,32 @@ export async function areasCommand(options) {
13
26
  console.log('No areas found.');
14
27
  return;
15
28
  }
16
- console.log(formatTable(['Name', 'Slug', 'Workspace', 'Role', 'Current'], areas.map((a) => [
29
+ // `_current` is the server's answer to "which area did this request carry"; the rung
30
+ // is purely local, so it is resolved here rather than read off the response. The global
31
+ // config must be passed in explicitly — it is the (weak) rung this column exists to expose.
32
+ const source = resolveArea({ config: await loadConfig() }).source;
33
+ console.log(formatTable(['Name', 'Slug', 'Workspace', 'Role', 'Resolves to'], areas.map((a) => [
17
34
  a.name,
18
35
  a.slug,
19
36
  a.workspace?.name ?? '',
20
37
  a.role,
21
- a._current ? '*' : '',
38
+ a._current ? `* ${sourceNote(source)}` : '',
22
39
  ])));
40
+ console.log('\n"Resolves to *" is where commands run from this directory land by default — a ' +
41
+ 'resolution default, not a choice you made. Pass --area <slug> to target another ' +
42
+ 'area; `orbitmap context` shows the directory → area map.');
23
43
  }
24
44
  catch (error) {
25
45
  printError(error, options.json);
26
46
  process.exitCode = 1;
27
47
  }
28
48
  }
49
+ /** Short parenthetical naming the rung, flagged when it is the weak machine-wide one. */
50
+ function sourceNote(source) {
51
+ if (!source)
52
+ return '';
53
+ return isStrongAreaSource(source)
54
+ ? `(from ${source})`
55
+ : `(from ${source} — machine-wide default, not this project)`;
56
+ }
29
57
  //# sourceMappingURL=areas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"areas.js","sourceRoot":"","sources":["../../src/commands/areas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAmBrE,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAElC;IACC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,aAAa,EAAE,CAAC;QACrC,MAAM,QAAQ,GAAG,CAAC,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAkB,CAAC;QAE5D,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;YAC1C,OAAO;QACT,CAAC;QAED,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC;QAE5B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;YAC/B,OAAO;QACT,CAAC;QAED,OAAO,CAAC,GAAG,CACT,WAAW,CACT,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,CAAC,EAChD,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;YACf,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,SAAS,EAAE,IAAI,IAAI,EAAE;YACvB,CAA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AAW,CAAC,EAAE,MAAM,EAAE,MAAM,UAAU,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC;QAElE,OAAO,CAAC,GAAG,CACT,WAAW,CACT,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,CAAC,EACpD,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;YACf,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,SAAS,EAAE,IAAI,IAAI,EAAE;YACvB,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;SAC5C,CAAC,CACH,CACF,CAAC;QACF,OAAO,CAAC,GAAG,CACT,kFAAkF;YAChF,kFAAkF;YAClF,0DAA0D,CAC7D,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAED,yFAAyF;AACzF,SAAS,UAAU,CAAC,MAA8B;IAChD,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,OAAO,kBAAkB,CAAC,MAAM,CAAC;QAC/B,CAAC,CAAC,SAAS,MAAM,GAAG;QACpB,CAAC,CAAC,SAAS,MAAM,4CAA4C,CAAC;AAClE,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export declare function assignCommand(objectId: string, agentId: string | undefined, options: {
2
2
  json: boolean;
3
3
  area?: string;
4
+ yes?: boolean;
4
5
  userId?: string;
5
6
  type?: string;
6
7
  }): Promise<void>;
@@ -1,4 +1,5 @@
1
1
  import { createAdapter } from '../adapters/factory.js';
2
+ import { confirmWriteTarget } from '../write-target.js';
2
3
  import { objectPrefix } from '../id-resolve.js';
3
4
  import { formatOutput, printError, printSuccess } from '../output.js';
4
5
  const VALID_OBJECT_TYPES = ['task', 'issue', 'idea', 'intent'];
@@ -43,6 +44,7 @@ export async function assignCommand(objectId, agentId, options) {
43
44
  process.exitCode = 1;
44
45
  return;
45
46
  }
47
+ await confirmWriteTarget('assign', options);
46
48
  const client = await createAdapter(options.area);
47
49
  let assignment;
48
50
  if (options.userId) {
@@ -1 +1 @@
1
- {"version":3,"file":"assign.js","sourceRoot":"","sources":["../../src/commands/assign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEtE,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAC;AAGxE,4FAA4F;AAC5F,6FAA6F;AAC7F,6EAA6E;AAC7E,MAAM,eAAe,GAAqC;IACxD,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,QAAQ;CACb,CAAC;AAsBF,SAAS,UAAU,CAAC,QAAgB,EAAE,QAAiB;IACrD,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,kBAAkB,CAAC,QAAQ,CAAC,QAA4B,CAAC;YAC9D,CAAC,CAAE,QAA6B;YAChC,CAAC,CAAC,IAAI,CAAC;IACX,CAAC;IACD,2FAA2F;IAC3F,6EAA6E;IAC7E,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACtC,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,eAAe,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC;IACzC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,QAAgB,EAChB,O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AAI,UAAU,KAAK,MAAM,EAAE,CAAC;YAC1B,MAAM,CAAC,GAAI,QAA+B,CAAC,IAAI,CAAC;YAChD,MAAM,GAAG,GAAG,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC;YACzE,YAAY,CAAC,oBAAoB,GAAG,GAAG,EAAE,KAAK,CAAC,CAAC;QAClD,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,GAAI,QAA+B,CAAC,IAAI,CAAC;YAChD,MAAM,GAAG,GAAG,CAAC,CAAC,gBAAgB,IAAI,CAAC,CAAC,iBAAiB,IAAI,EAAE,CAAC;YAC5D,YAAY,CACV,GAAG,UAAU,CAAC,CAAC,CAAE,CAAC,WAAW,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,QAAQ,gBAAgB,GAAG,GAAG,EACvF,KAAK,CACN,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
@@ -1,4 +1,99 @@
1
+ import { type AreaDirectoryMapping, type AreaSource, type OrbitMapMode, type WorkspaceSource } from '../workspace-resolve.js';
2
+ interface ContextResponse {
3
+ data: {
4
+ agent: {
5
+ id: string;
6
+ name: string;
7
+ slug: string;
8
+ };
9
+ area: {
10
+ id: string;
11
+ name: string;
12
+ slug: string;
13
+ description: string | null;
14
+ git_url: string | null;
15
+ default_branch: string;
16
+ } | null;
17
+ /**
18
+ * The areas of the resolved workspace this agent can work in. Present only on the
19
+ * workspace branch of the response — the whole point of it is that one `context` call
20
+ * tells the agent where it may work, so it never has to list areas to find out.
21
+ */
22
+ areas?: Array<{
23
+ id: string;
24
+ slug: string;
25
+ name: string;
26
+ role: string;
27
+ }>;
28
+ active_mission?: {
29
+ id: string;
30
+ display_number?: string;
31
+ name: string;
32
+ status: string;
33
+ } | null;
34
+ /** Open intents of the workspace — the work that outranks any single task. */
35
+ open_intents?: Array<{
36
+ number: string;
37
+ name: string;
38
+ status: string;
39
+ }>;
40
+ tasks: Array<{
41
+ id: string;
42
+ title: string;
43
+ status: string;
44
+ priority: string;
45
+ task_number: string;
46
+ display_number: string;
47
+ }>;
48
+ documents: Array<{
49
+ id: string;
50
+ title: string;
51
+ slug: string;
52
+ type: string;
53
+ _shared: boolean;
54
+ }>;
55
+ };
56
+ }
57
+ /**
58
+ * The workspace this invocation is scoped to.
59
+ *
60
+ * Always emitted as an object, with nullable members rather than a null block: a consumer
61
+ * can read `workspace.slug` unconditionally.
62
+ */
63
+ export interface ContextWorkspace {
64
+ /** Slug or uuid, whichever identified the workspace; never a path. */
65
+ slug: string | null;
66
+ /** Display name — only known when it can be read from a local `workspace.yml`. */
67
+ name: string | null;
68
+ /** Which rung of the workspace-identity ladder produced {@link ContextWorkspace.slug}. */
69
+ source: WorkspaceSource | null;
70
+ /** Absolute workspace directory; local mode only. */
71
+ path: string | null;
72
+ }
73
+ /** The `--json` payload: the adapter envelope plus the resolved local context. */
74
+ export interface ContextOutput extends ContextResponse {
75
+ workspace: ContextWorkspace;
76
+ /** Every directory → area mapping visible from `cwd`, deepest first. */
77
+ areas_map: AreaDirectoryMapping[];
78
+ /**
79
+ * The area commands actually target from this directory, or `null` (workspace scope).
80
+ *
81
+ * This is the *effective* area, not the raw ladder result: in local mode the workspace's
82
+ * own `default_area` (and the single-area fallback) outrank a leftover machine-wide
83
+ * `area`, so the ladder alone would name an area no command would use.
84
+ */
85
+ resolved_area: string | null;
86
+ /**
87
+ * Rung of the area ladder that produced {@link ContextOutput.resolved_area}, or
88
+ * `'workspace-default'` when the local workspace overrode the ladder.
89
+ */
90
+ area_source: AreaSource | 'workspace-default' | null;
91
+ mode: OrbitMapMode;
92
+ /** Directory the resolution ran from — what `resolved_area` is relative to. */
93
+ cwd: string;
94
+ }
1
95
  export declare function contextCommand(options: {
2
96
  json: boolean;
3
97
  area?: string;
4
98
  }): Promise<void>;
99
+ export {};