orbitmap 0.4.0-next.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.
Files changed (55) hide show
  1. package/README.md +148 -45
  2. package/dist/adapters/cloud.d.ts +36 -3
  3. package/dist/adapters/cloud.js +79 -17
  4. package/dist/adapters/cloud.js.map +1 -1
  5. package/dist/adapters/factory.d.ts +8 -4
  6. package/dist/adapters/factory.js +9 -5
  7. package/dist/adapters/factory.js.map +1 -1
  8. package/dist/adapters/local/context.d.ts +4 -3
  9. package/dist/adapters/local/context.js +4 -3
  10. package/dist/adapters/local/context.js.map +1 -1
  11. package/dist/commands/assign.js +9 -4
  12. package/dist/commands/assign.js.map +1 -1
  13. package/dist/commands/create.js +1 -6
  14. package/dist/commands/create.js.map +1 -1
  15. package/dist/commands/ideas.js +1 -6
  16. package/dist/commands/ideas.js.map +1 -1
  17. package/dist/commands/init.d.ts +28 -0
  18. package/dist/commands/init.js +248 -132
  19. package/dist/commands/init.js.map +1 -1
  20. package/dist/commands/issues.js +1 -6
  21. package/dist/commands/issues.js.map +1 -1
  22. package/dist/commands/setup-agent.d.ts +16 -0
  23. package/dist/commands/setup-agent.js +38 -5
  24. package/dist/commands/setup-agent.js.map +1 -1
  25. package/dist/commands/setup-mcp.js +13 -42
  26. package/dist/commands/setup-mcp.js.map +1 -1
  27. package/dist/commands/task.js +3 -13
  28. package/dist/commands/task.js.map +1 -1
  29. package/dist/config.d.ts +69 -17
  30. package/dist/config.js +206 -32
  31. package/dist/config.js.map +1 -1
  32. package/dist/doc-cache.d.ts +21 -1
  33. package/dist/doc-cache.js +72 -12
  34. package/dist/doc-cache.js.map +1 -1
  35. package/dist/id-resolve.d.ts +61 -0
  36. package/dist/id-resolve.js +87 -0
  37. package/dist/id-resolve.js.map +1 -0
  38. package/dist/index.js +26 -12
  39. package/dist/index.js.map +1 -1
  40. package/dist/mcp-config.d.ts +36 -0
  41. package/dist/mcp-config.js +51 -0
  42. package/dist/mcp-config.js.map +1 -0
  43. package/dist/oauth.d.ts +8 -0
  44. package/dist/oauth.js +54 -15
  45. package/dist/oauth.js.map +1 -1
  46. package/dist/paths.d.ts +97 -0
  47. package/dist/paths.js +178 -0
  48. package/dist/paths.js.map +1 -0
  49. package/dist/project-config.d.ts +75 -0
  50. package/dist/project-config.js +55 -0
  51. package/dist/project-config.js.map +1 -0
  52. package/dist/workspace-resolve.d.ts +56 -24
  53. package/dist/workspace-resolve.js +106 -25
  54. package/dist/workspace-resolve.js.map +1 -1
  55. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAiBjC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,WAAW,CAAC,CAAC;AAChD,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AAEpD,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAmB,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,MAAsB;IACrD,MAAM,KAAK,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,MAAM,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,I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QACvB,MAAM,GAAG,CAAC,MAAM,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC;IACpD,CAAC;IAED,qFAAqF;IACrF,IAAI,CAAC,MAAM;QAAE,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;IAErC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,uEAAuE,CACxE,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC"}
@@ -17,7 +17,27 @@ export interface DownloadResult {
17
17
  export declare function getCacheDir(): string;
18
18
  export declare function readManifest(): Manifest;
19
19
  export declare function writeManifest(manifest: Manifest): void;
20
- export declare function ensureGitignore(): void;
20
+ /**
21
+ * Append any of `entries` missing from `<cwd>/.gitignore` (creating the file if needed) and
22
+ * return the entries actually written.
23
+ *
24
+ * Idempotent — entries already present are left alone and nothing is written when there is
25
+ * nothing missing, which is why the return value matters: a caller that announces "added X
26
+ * to .gitignore" would otherwise say so on every re-run. Reused by `setup-mcp.ts` for
27
+ * `.mcp.json`, which carries a Bearer token the same way the doc cache and `link.json`
28
+ * carry no secret but still shouldn't be committed as machine-local state.
29
+ */
30
+ export declare function ensureGitignore(entries?: string[], cwd?: string): string[];
31
+ /**
32
+ * True when `.gitignore` already has a blanket `.orbitmap/` entry from before ADR 0002.
33
+ * Callers use this to warn instead of silently leaving the project's config untracked.
34
+ *
35
+ * A trailing comment (`.orbitmap/ # doc cache`) and surrounding whitespace are stripped
36
+ * before matching; negations (`!.orbitmap/config.json`) are not — a user who wrote one has
37
+ * already solved the problem this warning is about, so treating the blanket line as
38
+ * shadowing would be a false alarm.
39
+ */
40
+ export declare function gitignoreShadowsProjectConfig(cwd?: string): boolean;
21
41
  export declare function downloadDocument(client: WorkspaceAdapter, idOrSlug: string): Promise<DownloadResult>;
22
42
  export declare function cleanupCache(availableDocSlugs: string[]): {
23
43
  removed: string[];
package/dist/doc-cache.js CHANGED
@@ -22,19 +22,79 @@ export function writeManifest(manifest) {
22
22
  mkdirSync(dirname(manifestPath), { recursive: true });
23
23
  writeFileSync(manifestPath, JSON.stringify(manifest, null, 2), 'utf-8');
24
24
  }
25
- export function ensureGitignore() {
26
- const gitignorePath = '.gitignore';
27
- const entry = '.orbitmap/';
28
- if (existsSync(gitignorePath)) {
29
- const content = readFileSync(gitignorePath, 'utf-8');
30
- if (content.includes(entry))
31
- return;
32
- const separator = content.endsWith('\n') ? '' : '\n';
33
- writeFileSync(gitignorePath, `${content}${separator}${entry}\n`, 'utf-8');
34
- }
35
- else {
36
- writeFileSync(gitignorePath, `${entry}\n`, 'utf-8');
25
+ /**
26
+ * Entries this cache needs ignored when no more specific list is given: the download cache
27
+ * itself and the local-workspace pointer file. Deliberately **not** a blanket `.orbitmap/`
28
+ * — `<project>/.orbitmap/config.json` (ADR 0002) lives in the same directory and is meant
29
+ * to be committed, so ignoring the whole directory would silently swallow it.
30
+ */
31
+ const DEFAULT_GITIGNORE_ENTRIES = ['.orbitmap/docs/', '.orbitmap/link.json'];
32
+ /**
33
+ * Append any of `entries` missing from `<cwd>/.gitignore` (creating the file if needed) and
34
+ * return the entries actually written.
35
+ *
36
+ * Idempotent — entries already present are left alone and nothing is written when there is
37
+ * nothing missing, which is why the return value matters: a caller that announces "added X
38
+ * to .gitignore" would otherwise say so on every re-run. Reused by `setup-mcp.ts` for
39
+ * `.mcp.json`, which carries a Bearer token the same way the doc cache and `link.json`
40
+ * carry no secret but still shouldn't be committed as machine-local state.
41
+ */
42
+ export function ensureGitignore(entries = DEFAULT_GITIGNORE_ENTRIES, cwd = process.cwd()) {
43
+ const gitignorePath = join(cwd, '.gitignore');
44
+ const existing = existsSync(gitignorePath) ? readFileSync(gitignorePath, 'utf-8') : '';
45
+ const existingLines = new Set(existing.split(/\r?\n/).map((line) => line.trim()));
46
+ const missing = entries.filter((entry) => !existingLines.has(entry));
47
+ if (missing.length === 0)
48
+ return [];
49
+ const separator = existing.length > 0 && !existing.endsWith('\n') ? '\n' : '';
50
+ writeFileSync(gitignorePath, `${existing}${separator}${missing.join('\n')}\n`, 'utf-8');
51
+ return missing;
52
+ }
53
+ /**
54
+ * Every `.gitignore` line shape that ignores the whole `.orbitmap/` directory — and
55
+ * therefore also hides the new, committable `.orbitmap/config.json` (ADR 0002).
56
+ *
57
+ * git treats a pattern containing no slash (other than a trailing one) as matching at every
58
+ * level, so `**​/.orbitmap/` and `.orbitmap/*` are the same blanket in practice as the plain
59
+ * `.orbitmap/` this CLI used to write.
60
+ */
61
+ const BLANKET_ORBITMAP_PATTERNS = new Set([
62
+ '.orbitmap',
63
+ '.orbitmap/',
64
+ '.orbitmap/*',
65
+ '.orbitmap/**',
66
+ '/.orbitmap',
67
+ '/.orbitmap/',
68
+ '/.orbitmap/*',
69
+ '/.orbitmap/**',
70
+ '**/.orbitmap',
71
+ '**/.orbitmap/',
72
+ '**/.orbitmap/*',
73
+ '**/.orbitmap/**',
74
+ ]);
75
+ /**
76
+ * True when `.gitignore` already has a blanket `.orbitmap/` entry from before ADR 0002.
77
+ * Callers use this to warn instead of silently leaving the project's config untracked.
78
+ *
79
+ * A trailing comment (`.orbitmap/ # doc cache`) and surrounding whitespace are stripped
80
+ * before matching; negations (`!.orbitmap/config.json`) are not — a user who wrote one has
81
+ * already solved the problem this warning is about, so treating the blanket line as
82
+ * shadowing would be a false alarm.
83
+ */
84
+ export function gitignoreShadowsProjectConfig(cwd = process.cwd()) {
85
+ const gitignorePath = join(cwd, '.gitignore');
86
+ if (!existsSync(gitignorePath))
87
+ return false;
88
+ const lines = readFileSync(gitignorePath, 'utf-8').split(/\r?\n/).map(normalizeGitignoreLine);
89
+ if (lines.some((line) => line === '!.orbitmap/config.json' || line === '!/.orbitmap/config.json')) {
90
+ return false;
37
91
  }
92
+ return lines.some((line) => BLANKET_ORBITMAP_PATTERNS.has(line));
93
+ }
94
+ /** Strip a trailing `#` comment and surrounding whitespace from one `.gitignore` line. */
95
+ function normalizeGitignoreLine(line) {
96
+ const withoutComment = line.replace(/(?:^|\s)#.*$/, '');
97
+ return withoutComment.trim();
38
98
  }
39
99
  export async function downloadDocument(client, idOrSlug) {
40
100
  const response = (await client.getDocument(idOrSlug, 'file'));
@@ -1 +1 @@
1
- {"version":3,"file":"doc-cache.js","sourceRoot":"","sources":["../src/doc-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnG,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgC1C,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;AAC5C,MAAM,aAAa,GAAG,gBAAgB,CAAC;AACvC,MAAM,UAAU,GAAG,CAAC,CAAC;AAErB,MAAM,UAAU,WAAW;IACzB,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;IACpD,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;QAAE,OAAO,EAAE,CAAC;IACzC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAa,CAAC;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,QAAkB;IAC9C,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;IACpD,SAAS,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,aAAa,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,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AAS;QAEhC,MAAM,YAAY,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE,CAAC;QAC7D,IAAI,GAAG,GAAG,YAAY,IAAI,OAAO;YAAE,SAAS;QAE5C,2CAA2C;QAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC;YACH,IAAI,UAAU,CAAC,QAAQ,CAAC;gBAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;QACjD,CAAC;QAAC,MAAM,CAAC;YACP,8BAA8B;QAChC,CAAC;QACD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Prefixed display IDs (`TS-uw9yh5`, `IS-4k2p9q`, …) are what the CLI prints and therefore
3
+ * what users paste back in. This module is the single place that understands them.
4
+ *
5
+ * The Agent API is asymmetric about them: `/issues/{id}`, `/ideas/{id}`, `/intents/{id}` and
6
+ * `/missions/{id}` resolve a prefixed ID inline, server-side, but **tasks do not** — a task
7
+ * reference that is not a uuid has to go through `/tasks/by-number/{number}` first, with the
8
+ * `TS-` prefix stripped. Before this module the CLI patched that around in four copies of the
9
+ * same two helpers and simply omitted it in eight commands, so the same identifier worked in
10
+ * `orbitmap task` and 404'd in `orbitmap status`.
11
+ *
12
+ * Resolution lives in the adapter layer (see `resolveTaskRef` below and its callers in
13
+ * `adapters/cloud.ts`), not in the commands: per CLAUDE.md commands never talk to the network
14
+ * and never reimplement rules, and putting it there means a new task command gets prefixed-ID
15
+ * support for free instead of having to remember. `LocalAdapter` already resolves every task
16
+ * reference through `requireTaskFile`, so this brings cloud mode up to the same contract.
17
+ */
18
+ /** Two-letter prefix → object type, as the Agent API assigns them. */
19
+ export declare const OBJECT_PREFIXES: {
20
+ readonly TS: "task";
21
+ readonly IS: "issue";
22
+ readonly ID: "idea";
23
+ readonly VB: "vibe";
24
+ readonly IN: "intent";
25
+ readonly MS: "mission";
26
+ };
27
+ export type ObjectPrefix = keyof typeof OBJECT_PREFIXES;
28
+ /**
29
+ * A prefixed display ID or a bare object code — i.e. anything that is NOT a uuid and has to
30
+ * be resolved by number. Six base-36 characters, optionally behind a two-letter prefix.
31
+ *
32
+ * This is the one shared predicate for the number-vs-uuid decision; a uuid is 36 characters
33
+ * with dashes and can never match, and a value that matches can never be a uuid, so the two
34
+ * paths are mutually exclusive by construction. Kept byte-identical to the four helper copies
35
+ * it replaces so no existing input changes meaning.
36
+ */
37
+ export declare function isObjectNumber(id: string): boolean;
38
+ /** Canonical uuid check, for callers that need the positive form rather than {@link isObjectNumber}. */
39
+ export declare function isUuid(id: string): boolean;
40
+ /**
41
+ * Drop the two-letter prefix from a display ID, leaving the bare object code. A value with no
42
+ * prefix (a bare code, or a uuid) is returned unchanged, so this is safe to call on anything.
43
+ */
44
+ export declare function stripPrefix(id: string): string;
45
+ /** The prefix of a display ID, or `undefined` when there is none. Never mangles the input. */
46
+ export declare function objectPrefix(id: string): ObjectPrefix | undefined;
47
+ /** The subset of the adapter surface {@link resolveTaskRef} needs. */
48
+ export interface TaskNumberLookup {
49
+ getTaskByNumber(taskNumber: string): Promise<unknown>;
50
+ }
51
+ /**
52
+ * Turn any task reference — uuid, `TS-uw9yh5` or the bare code `uw9yh5` — into the uuid the
53
+ * task endpoints expect.
54
+ *
55
+ * A uuid costs **no extra request**: it is returned as-is, synchronously in effect, so the
56
+ * commands that already passed uuids keep their single round trip. Only a by-number reference
57
+ * pays for the `/tasks/by-number/{n}` lookup, which is the price of the API asymmetry this
58
+ * works around (see the module comment) and disappears if `/tasks/{id}` ever resolves
59
+ * prefixed IDs inline the way `/intents/{id}` already does.
60
+ */
61
+ export declare function resolveTaskRef(ref: string, lookup: TaskNumberLookup): Promise<string>;
@@ -0,0 +1,87 @@
1
+ import { OrbitMapAPIError } from './errors.js';
2
+ /**
3
+ * Prefixed display IDs (`TS-uw9yh5`, `IS-4k2p9q`, …) are what the CLI prints and therefore
4
+ * what users paste back in. This module is the single place that understands them.
5
+ *
6
+ * The Agent API is asymmetric about them: `/issues/{id}`, `/ideas/{id}`, `/intents/{id}` and
7
+ * `/missions/{id}` resolve a prefixed ID inline, server-side, but **tasks do not** — a task
8
+ * reference that is not a uuid has to go through `/tasks/by-number/{number}` first, with the
9
+ * `TS-` prefix stripped. Before this module the CLI patched that around in four copies of the
10
+ * same two helpers and simply omitted it in eight commands, so the same identifier worked in
11
+ * `orbitmap task` and 404'd in `orbitmap status`.
12
+ *
13
+ * Resolution lives in the adapter layer (see `resolveTaskRef` below and its callers in
14
+ * `adapters/cloud.ts`), not in the commands: per CLAUDE.md commands never talk to the network
15
+ * and never reimplement rules, and putting it there means a new task command gets prefixed-ID
16
+ * support for free instead of having to remember. `LocalAdapter` already resolves every task
17
+ * reference through `requireTaskFile`, so this brings cloud mode up to the same contract.
18
+ */
19
+ /** Two-letter prefix → object type, as the Agent API assigns them. */
20
+ export const OBJECT_PREFIXES = {
21
+ TS: 'task',
22
+ IS: 'issue',
23
+ ID: 'idea',
24
+ VB: 'vibe',
25
+ IN: 'intent',
26
+ MS: 'mission',
27
+ };
28
+ /**
29
+ * A prefixed display ID or a bare object code — i.e. anything that is NOT a uuid and has to
30
+ * be resolved by number. Six base-36 characters, optionally behind a two-letter prefix.
31
+ *
32
+ * This is the one shared predicate for the number-vs-uuid decision; a uuid is 36 characters
33
+ * with dashes and can never match, and a value that matches can never be a uuid, so the two
34
+ * paths are mutually exclusive by construction. Kept byte-identical to the four helper copies
35
+ * it replaces so no existing input changes meaning.
36
+ */
37
+ export function isObjectNumber(id) {
38
+ return /^([A-Z]{2}-)?[a-z0-9]{6}$/.test(id.trim());
39
+ }
40
+ /** Canonical uuid check, for callers that need the positive form rather than {@link isObjectNumber}. */
41
+ export function isUuid(id) {
42
+ return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(id.trim());
43
+ }
44
+ /**
45
+ * Drop the two-letter prefix from a display ID, leaving the bare object code. A value with no
46
+ * prefix (a bare code, or a uuid) is returned unchanged, so this is safe to call on anything.
47
+ */
48
+ export function stripPrefix(id) {
49
+ return id.trim().replace(/^[A-Z]{2}-/, '');
50
+ }
51
+ /** The prefix of a display ID, or `undefined` when there is none. Never mangles the input. */
52
+ export function objectPrefix(id) {
53
+ const match = id.trim().match(/^([A-Z]{2})-/);
54
+ const prefix = match?.[1];
55
+ return prefix && prefix in OBJECT_PREFIXES ? prefix : undefined;
56
+ }
57
+ /** Dig the task uuid out of a `/tasks/by-number/{n}` (or `/tasks/{id}`) response envelope. */
58
+ function taskIdFromEnvelope(response) {
59
+ const data = response?.data;
60
+ const task = data?.task ?? data;
61
+ const id = task?.id;
62
+ return typeof id === 'string' && id.length > 0 ? id : undefined;
63
+ }
64
+ /**
65
+ * Turn any task reference — uuid, `TS-uw9yh5` or the bare code `uw9yh5` — into the uuid the
66
+ * task endpoints expect.
67
+ *
68
+ * A uuid costs **no extra request**: it is returned as-is, synchronously in effect, so the
69
+ * commands that already passed uuids keep their single round trip. Only a by-number reference
70
+ * pays for the `/tasks/by-number/{n}` lookup, which is the price of the API asymmetry this
71
+ * works around (see the module comment) and disappears if `/tasks/{id}` ever resolves
72
+ * prefixed IDs inline the way `/intents/{id}` already does.
73
+ */
74
+ export async function resolveTaskRef(ref, lookup) {
75
+ const trimmed = ref.trim();
76
+ if (!isObjectNumber(trimmed))
77
+ return trimmed;
78
+ const response = await lookup.getTaskByNumber(stripPrefix(trimmed));
79
+ const id = taskIdFromEnvelope(response);
80
+ if (!id) {
81
+ // The lookup answered but without an id — a contract drift we must not paper over by
82
+ // sending the unresolved reference on and letting it 404 somewhere less obvious.
83
+ throw new OrbitMapAPIError(`Could not resolve task \`${trimmed}\` to an id — the API returned no task id for it.`, 'NOT_FOUND', 404);
84
+ }
85
+ return id;
86
+ }
87
+ //# sourceMappingURL=id-resolve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id-resolve.js","sourceRoot":"","sources":["../src/id-resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;;;;;;;;;;;;GAgBG;AAEH,sEAAsE;AACtE,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,SAAS;CACL,CAAC;AAIX;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,EAAU;IACvC,OAAO,2BAA2B,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;AACrD,CAAC;AAED,wGAAwG;AACxG,MAAM,UAAU,MAAM,CAAC,EAAU;IAC/B,OAAO,iEAAiE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;AAC3F,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,EAAU;IACpC,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAC7C,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,YAAY,CAAC,EAAU;IACrC,MAAM,KAAK,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1B,OAAO,MAAM,IAAI,MAAM,IAAI,eAAe,CAAC,CAAC,CAAE,MAAuB,CAAC,CAAC,CAAC,SAAS,CAAC;AACpF,CAAC;AAOD,8FAA8F;AAC9F,SAAS,kBAAkB,CAAC,QAAiB;IAC3C,MAAM,IAAI,GAAI,QAA+B,EAAE,IAAI,CAAC;IACpD,MAAM,IAAI,GAAI,IAA2B,EAAE,IAAI,IAAI,IAAI,CAAC;IACxD,MAAM,EAAE,GAAI,IAAyB,EAAE,EAAE,CAAC;IAC1C,OAAO,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAClE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,GAAW,EACX,MAAwB;IAExB,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IAE7C,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;IACpE,MAAM,EAAE,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACxC,IAAI,CAAC,EAAE,EAAE,CAAC;QACR,qFAAqF;QACrF,iFAAiF;QACjF,MAAM,IAAI,gBAAgB,CACxB,4BAA4B,OAAO,mDAAmD,EACtF,WAAW,EACX,GAAG,CACJ,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
package/dist/index.js CHANGED
@@ -33,13 +33,21 @@ import { intentListCommand, intentShowCommand, intentCreateCommand, intentUpdate
33
33
  import { missionListCommand, missionShowCommand, missionCreateCommand, missionUpdateCommand, missionStatusCommand, missionLinkCommand, missionUnlinkCommand, } from './commands/mission.js';
34
34
  import { depAddCommand, depRemoveCommand } from './commands/dep.js';
35
35
  import { getCommand } from './commands/get.js';
36
+ import { createRequire } from 'node:module';
36
37
  import { createAreaCommand } from './commands/create-area.js';
37
38
  import { setWorkspaceFlag } from './workspace-resolve.js';
38
39
  const program = new Command();
40
+ /**
41
+ * `--version` reads the real package version instead of a hardcoded literal, which had gone
42
+ * stale (it still said 0.3.0 two releases later, so `orbitmap --version` lied about what was
43
+ * installed). `../package.json` resolves to the repo root from both `src/` and `dist/`, and npm
44
+ * always ships package.json in the tarball regardless of the `files` allow-list.
45
+ */
46
+ const { version } = createRequire(import.meta.url)('../package.json');
39
47
  program
40
48
  .name('orbitmap')
41
49
  .description('CLI tool for OrbitMap Agent API')
42
- .version('0.3.0')
50
+ .version(version)
43
51
  .option('--json', 'Output in JSON format', false)
44
52
  .option('--area <id>', 'Area ID or slug to use')
45
53
  .option('--workspace <path>', 'Local workspace directory to use (local mode)');
@@ -60,6 +68,9 @@ program
60
68
  .option('--workspace <path>', 'Local workspace directory (default: ./.orbitmap)')
61
69
  .option('--workspace-name <name>', 'Local workspace name (default: current directory name)')
62
70
  .option('--no-skills', 'Skip installing the OrbitMap agent skills')
71
+ .option('--agent <type>', 'Coding agent to install the skills for: claude, gemini, codex, cursor, windsurf, generic ' +
72
+ '(default: detected from this directory, or asked)')
73
+ .option('--global', 'Cloud: write to ~/.orbitmap/config.json instead of ./.orbitmap/config.json')
63
74
  .action(async (opts, command) => {
64
75
  // `--workspace` also exists as a program-level flag, and Commander binds it there;
65
76
  // `optsWithGlobals()` picks it up whichever position it was given in.
@@ -74,6 +85,8 @@ program
74
85
  workspace: opts.workspace ?? all['workspace'],
75
86
  workspaceName: opts.workspaceName,
76
87
  skills: opts.skills,
88
+ agent: opts.agent,
89
+ global: opts.global,
77
90
  });
78
91
  });
79
92
  program
@@ -157,14 +170,14 @@ program
157
170
  await getCommand(prefixedId, { json: globalOpts.json, area: globalOpts.area });
158
171
  });
159
172
  program
160
- .command('task <id>')
161
- .description('Show full task details (UUID or task number)')
173
+ .command('task <id-or-number>')
174
+ .description('Show full task details (UUID, TS-prefixed ID, or task number)')
162
175
  .action(async (id, _opts, cmd) => {
163
176
  const globalOpts = cmd.optsWithGlobals();
164
177
  await taskCommand(id, { json: globalOpts.json, area: globalOpts.area });
165
178
  });
166
179
  program
167
- .command('task-edit-content <task-id>')
180
+ .command('task-edit-content <id-or-number>')
168
181
  .description('Edit task content (title, description, agent instructions)')
169
182
  .option('--title <title>', 'New title')
170
183
  .option('--description <text>', 'New description')
@@ -180,14 +193,14 @@ program
180
193
  });
181
194
  });
182
195
  program
183
- .command('start [task-id]')
196
+ .command('start [id-or-number]')
184
197
  .description('Start working on a task (auto-pick if no ID given)')
185
198
  .action(async (taskId, _opts, cmd) => {
186
199
  const globalOpts = cmd.optsWithGlobals();
187
200
  await startCommand(taskId, { json: globalOpts.json, area: globalOpts.area });
188
201
  });
189
202
  program
190
- .command('status <task-id> <status>')
203
+ .command('status <id-or-number> <status>')
191
204
  .description('Update task status (backlog, todo, in_progress, in_review, review_changes, done, blocked)')
192
205
  .option('--delivery <status>', 'Delivery status: on_branch, merged, released')
193
206
  .option('--force', 'Allow done even with unfinished subtasks')
@@ -231,7 +244,7 @@ program
231
244
  });
232
245
  });
233
246
  program
234
- .command('subtask <parent-id> <title>')
247
+ .command('subtask <parent-id-or-number> <title>')
235
248
  .description('Create a subtask under a parent task')
236
249
  .option('--desc <description>', 'Subtask description')
237
250
  .option('--priority <priority>', 'Priority (critical, high, medium, low)')
@@ -247,7 +260,7 @@ program
247
260
  });
248
261
  });
249
262
  program
250
- .command('assign <id> [agent-id]')
263
+ .command('assign <id-or-number> [agent-id]')
251
264
  .description('Assign a task, issue, idea, or intent to an agent or user')
252
265
  .option('--user-id <id>', 'Assign to a user (by user ID) instead of an agent')
253
266
  .option('--type <type>', 'Object type: task, issue, idea, intent (auto-detected from prefixed IDs; default task)')
@@ -261,7 +274,7 @@ program
261
274
  });
262
275
  });
263
276
  program
264
- .command('log <task-id> <message>')
277
+ .command('log <id-or-number> <message>')
265
278
  .description('Log work on a task')
266
279
  .option('--type <type>', 'Log type: note, code_change, decision, blocker, discovery, exploration, fix', 'note')
267
280
  .option('--meta <json>', 'JSON metadata (e.g. \'{"files":["..."]}\')')
@@ -421,7 +434,8 @@ program
421
434
  });
422
435
  program
423
436
  .command('setup-agent')
424
- .description('Add OrbitMap instructions to your agent config file')
437
+ .description('Refresh the OrbitMap agent instructions/skills, or add another agent type ' +
438
+ '(`init` already installs them once)')
425
439
  .option('--agent <type>', 'Agent type: claude, gemini, codex, cursor, windsurf, generic')
426
440
  .action(async (opts) => {
427
441
  await setupAgentCommand({ agent: opts.agent });
@@ -1067,7 +1081,7 @@ const dep = program
1067
1081
  .command('dep')
1068
1082
  .description('Manage task dependencies');
1069
1083
  dep
1070
- .command('add <task-id> <target-task-id>')
1084
+ .command('add <id-or-number> <target-id-or-number>')
1071
1085
  .description('Add a dependency between tasks')
1072
1086
  .option('--type <type>', 'Dependency type: depends_on, related', 'depends_on')
1073
1087
  .option('--note <text>', 'Optional note for the dependency')
@@ -1081,7 +1095,7 @@ dep
1081
1095
  });
1082
1096
  });
1083
1097
  dep
1084
- .command('remove <task-id> <target-task-id>')
1098
+ .command('remove <id-or-number> <target-id-or-number>')
1085
1099
  .description('Remove a dependency between tasks')
1086
1100
  .option('--type <type>', 'Dependency type to remove: depends_on, related')
1087
1101
  .action(async (taskId, targetTaskId, opts, cmd) => {