orbitmap 0.4.6 → 0.6.0

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 (94) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +73 -10
  3. package/dist/adapters/cloud.d.ts +85 -10
  4. package/dist/adapters/cloud.js +118 -17
  5. package/dist/adapters/cloud.js.map +1 -1
  6. package/dist/adapters/factory.js +7 -0
  7. package/dist/adapters/factory.js.map +1 -1
  8. package/dist/adapters/local/adapter.d.ts +47 -8
  9. package/dist/adapters/local/adapter.js +37 -17
  10. package/dist/adapters/local/adapter.js.map +1 -1
  11. package/dist/adapters/local/context.d.ts +13 -1
  12. package/dist/adapters/local/context.js +7 -2
  13. package/dist/adapters/local/context.js.map +1 -1
  14. package/dist/adapters/local/entities/documents.d.ts +18 -4
  15. package/dist/adapters/local/entities/documents.js +46 -7
  16. package/dist/adapters/local/entities/documents.js.map +1 -1
  17. package/dist/adapters/local/entities/planning.d.ts +36 -7
  18. package/dist/adapters/local/entities/planning.js +245 -39
  19. package/dist/adapters/local/entities/planning.js.map +1 -1
  20. package/dist/adapters/local/entities/tasks.d.ts +16 -7
  21. package/dist/adapters/local/entities/tasks.js +55 -42
  22. package/dist/adapters/local/entities/tasks.js.map +1 -1
  23. package/dist/adapters/local/entities/work-items.d.ts +28 -7
  24. package/dist/adapters/local/entities/work-items.js +111 -39
  25. package/dist/adapters/local/entities/work-items.js.map +1 -1
  26. package/dist/adapters/local/lists.d.ts +139 -0
  27. package/dist/adapters/local/lists.js +230 -0
  28. package/dist/adapters/local/lists.js.map +1 -0
  29. package/dist/adapters/local/rules.d.ts +1 -1
  30. package/dist/adapters/local/rules.js +23 -0
  31. package/dist/adapters/local/rules.js.map +1 -1
  32. package/dist/adapters/local/shapes.d.ts +165 -22
  33. package/dist/adapters/local/shapes.js +338 -50
  34. package/dist/adapters/local/shapes.js.map +1 -1
  35. package/dist/adapters/local/types.d.ts +6 -1
  36. package/dist/adapters/local/types.js.map +1 -1
  37. package/dist/adapters/types.d.ts +72 -9
  38. package/dist/agent-instructions.d.ts +41 -11
  39. package/dist/agent-instructions.js +329 -128
  40. package/dist/agent-instructions.js.map +1 -1
  41. package/dist/commands/context.d.ts +62 -37
  42. package/dist/commands/context.js +105 -36
  43. package/dist/commands/context.js.map +1 -1
  44. package/dist/commands/docs.d.ts +4 -0
  45. package/dist/commands/docs.js +12 -5
  46. package/dist/commands/docs.js.map +1 -1
  47. package/dist/commands/emit-instructions.d.ts +26 -0
  48. package/dist/commands/emit-instructions.js +68 -0
  49. package/dist/commands/emit-instructions.js.map +1 -0
  50. package/dist/commands/ideas.d.ts +3 -0
  51. package/dist/commands/ideas.js +14 -7
  52. package/dist/commands/ideas.js.map +1 -1
  53. package/dist/commands/intent.d.ts +26 -0
  54. package/dist/commands/intent.js +117 -8
  55. package/dist/commands/intent.js.map +1 -1
  56. package/dist/commands/issues.d.ts +4 -0
  57. package/dist/commands/issues.js +15 -7
  58. package/dist/commands/issues.js.map +1 -1
  59. package/dist/commands/mission.d.ts +2 -0
  60. package/dist/commands/mission.js +9 -5
  61. package/dist/commands/mission.js.map +1 -1
  62. package/dist/commands/projects.d.ts +3 -0
  63. package/dist/commands/projects.js +28 -0
  64. package/dist/commands/projects.js.map +1 -0
  65. package/dist/commands/setup-agent.d.ts +101 -13
  66. package/dist/commands/setup-agent.js +377 -31
  67. package/dist/commands/setup-agent.js.map +1 -1
  68. package/dist/commands/start.d.ts +13 -0
  69. package/dist/commands/start.js +126 -13
  70. package/dist/commands/start.js.map +1 -1
  71. package/dist/commands/tasks.d.ts +23 -5
  72. package/dist/commands/tasks.js +46 -23
  73. package/dist/commands/tasks.js.map +1 -1
  74. package/dist/commands/vibes.d.ts +3 -0
  75. package/dist/commands/vibes.js +11 -5
  76. package/dist/commands/vibes.js.map +1 -1
  77. package/dist/errors.d.ts +23 -2
  78. package/dist/errors.js +31 -3
  79. package/dist/errors.js.map +1 -1
  80. package/dist/index.js +118 -38
  81. package/dist/index.js.map +1 -1
  82. package/dist/list-meta.d.ts +117 -0
  83. package/dist/list-meta.js +160 -0
  84. package/dist/list-meta.js.map +1 -0
  85. package/dist/list-options.d.ts +33 -0
  86. package/dist/list-options.js +70 -0
  87. package/dist/list-options.js.map +1 -0
  88. package/dist/workspace-resolve.d.ts +47 -1
  89. package/dist/workspace-resolve.js +74 -11
  90. package/dist/workspace-resolve.js.map +1 -1
  91. package/dist/write-target.d.ts +9 -0
  92. package/dist/write-target.js +11 -2
  93. package/dist/write-target.js.map +1 -1
  94. package/package.json +1 -1
@@ -6,7 +6,7 @@ export type AgentType = 'claude' | 'gemini' | 'codex' | 'cursor' | 'windsurf' |
6
6
  * `~/.codex`). This is the DEFAULT, because agent skills do **not** traverse
7
7
  * directories: a project-level `.claude/skills/` is invisible to a session
8
8
  * started in a sibling or child repository, while `CLAUDE.md` *is* inherited
9
- * downwards — so a project-scope install hands sub-directories a hook that
9
+ * downwards — so a project-scope install hands sub-directories a block that
10
10
  * tells them to load skills they cannot see. A workspace now legitimately
11
11
  * spans several area directories (IN-rwb5qu), so one project-scope install
12
12
  * would only ever cover one of them.
@@ -45,12 +45,59 @@ export interface InstallTarget {
45
45
  * Resolve where an install lands.
46
46
  *
47
47
  * User scope writes **only** under the agent's personal config directory — nothing is
48
- * written into the project. That is the point: at user scope the skills and the hook
48
+ * written into the project. That is the point: at user scope the skills and the block
49
49
  * that references them are both visible from every directory, so there is no reason to
50
50
  * leave a second, narrower copy behind in one repository.
51
51
  */
52
52
  export declare function resolveInstallTarget(agentType: AgentType, scope: SkillScope, cwd: string, homeDir?: string): InstallTarget;
53
53
  export declare function detectAgent(cwdOverride?: string): AgentType | null;
54
+ /**
55
+ * The command our PostToolUse hook entry runs (`src/commands/emit-instructions.ts`): it
56
+ * re-emits any `Instructions (…)` block from an orbitmap command's stdout as
57
+ * `additionalContext`, so the block lands at instruction tier instead of data tier.
58
+ *
59
+ * This string is also the entry's IDENTITY. JSON has no comments, so the
60
+ * `ORBITMAP_START`/`ORBITMAP_END` marker convention the markdown blocks rely on cannot be
61
+ * reproduced here — our entry is recognised by `command === EMIT_INSTRUCTIONS_COMMAND`,
62
+ * never by array position. Changing this string orphans every installed entry.
63
+ */
64
+ export declare const EMIT_INSTRUCTIONS_COMMAND = "orbitmap emit-instructions";
65
+ /**
66
+ * Where the hook entry lives for a resolved install target, or `null` when this agent
67
+ * has no hook mechanism this CLI knows how to write.
68
+ *
69
+ * - Claude Code: `settings.json` in the same `.claude/` directory as the skills — the
70
+ * hook always lands in the scope the rest of the install used (project install →
71
+ * `<project>/.claude/settings.json`, user install → `~/.claude/settings.json`).
72
+ * - Codex: `hooks.json` next to the `AGENTS.md` the instructions block went into —
73
+ * but only at user scope: Codex reads hooks from its `~/.codex` directory only, so a
74
+ * project-scope install writes none (and says so).
75
+ *
76
+ * Paths are derived from the {@link InstallTarget}, never from `os.homedir()` directly,
77
+ * so hermetic tests that pass an explicit home stay inside their sandbox.
78
+ */
79
+ export declare function resolveHookSettingsPath(agentType: AgentType, target: InstallTarget): string | null;
80
+ export type HookWriteResult = 'created' | 'updated' | 'unchanged' | 'skipped';
81
+ /**
82
+ * Install our PostToolUse hook entry into `settingsPath`, idempotently and in the spirit
83
+ * of {@link writeBlock}: every key we do not own is preserved verbatim, our entry is
84
+ * APPENDED beside any hooks the user already has, and a second run changes nothing
85
+ * (`unchanged` leaves the file byte-identical).
86
+ *
87
+ * A file that is not valid JSON (or not a JSON object) is never rewritten — that returns
88
+ * `skipped`, and the caller must say so out loud: a hook silently not installed is a
89
+ * dead channel with no signal.
90
+ */
91
+ export declare function writeEmitInstructionsHook(settingsPath: string): HookWriteResult;
92
+ /**
93
+ * Remove our hook entry from `settingsPath` — and nothing else.
94
+ *
95
+ * Mirrors the guarantee of {@link removeProjectInstall}: a user's own hooks and every
96
+ * unrelated key survive verbatim, an unreadable file is left alone, and the file itself
97
+ * is deleted only when our entry was its entire content (i.e. this CLI created it).
98
+ * Returns whether anything was removed.
99
+ */
100
+ export declare function removeEmitInstructionsHook(settingsPath: string): boolean;
54
101
  /**
55
102
  * What a previous project-scope install left behind in `cwd`.
56
103
  *
@@ -65,24 +112,28 @@ export interface StaleProjectInstall {
65
112
  skillDirs: string[];
66
113
  /** Absolute path of the agent config file that still carries our marker block, if any. */
67
114
  configPath: string | null;
115
+ /** Absolute path of a `.claude/settings.json` that still carries our hook entry, if any. */
116
+ settingsPath: string | null;
68
117
  }
69
118
  /**
70
119
  * Find a previous project-scope install in `cwd`.
71
120
  *
72
- * Deliberately narrow: only the five skill directories this CLI creates by name, and only
73
- * a config file that actually contains OUR marker block. A user's own skill in
74
- * `.claude/skills/`, an unrelated `CLAUDE.md`, or a `.claude/` holding only settings are
75
- * invisible here which is what makes the cleanup below safe.
121
+ * Deliberately narrow: only the five skill directories this CLI creates by name, only
122
+ * a config file that actually contains OUR marker block, and only a `settings.json`
123
+ * that actually contains OUR hook entry. A user's own skill in `.claude/skills/`, an
124
+ * unrelated `CLAUDE.md`, or a `.claude/settings.json` without our entry are invisible
125
+ * here — which is what makes the cleanup below safe.
76
126
  */
77
127
  export declare function detectProjectInstall(cwd: string, agentType: AgentType): StaleProjectInstall | null;
78
128
  /**
79
129
  * Remove a stale project-scope install — and nothing else.
80
130
  *
81
- * Only ever touches: the five skill directories named in {@link StaleProjectInstall}, and
82
- * the marker-delimited block inside the config file. Text outside the markers is kept
83
- * verbatim; the config file itself is deleted only when the block was its entire content
84
- * (i.e. this CLI created it). Parent directories are removed only when they are already
85
- * empty a `.claude/` holding a user's own skills or `settings.json` survives intact.
131
+ * Only ever touches: the five skill directories named in {@link StaleProjectInstall},
132
+ * the marker-delimited block inside the config file, and OUR hook entry inside
133
+ * `settings.json`. Text outside the markers and every settings key that is not our
134
+ * entry is kept verbatim; each file is deleted only when our content was its entire
135
+ * content (i.e. this CLI created it). Parent directories are removed only when they are
136
+ * already empty — a `.claude/` holding a user's own skills or settings survives intact.
86
137
  * There is no recursive delete of `.claude` anywhere in this function.
87
138
  */
88
139
  export declare function removeProjectInstall(stale: StaleProjectInstall): string[];
@@ -102,8 +153,10 @@ export declare function parseAgentType(value: string): AgentType | null;
102
153
  * Install the OrbitMap skills for one agent, non-interactively and idempotently.
103
154
  *
104
155
  * At the default `user` scope: Claude Code → `~/.claude/skills/<name>/SKILL.md` × 4 +
105
- * the hook block in `~/.claude/CLAUDE.md`; Gemini/Codex the inlined block in
106
- * `~/.gemini/GEMINI.md` / `~/.codex/AGENTS.md`. **Nothing is written into `cwd`.**
156
+ * the instructions block in `~/.claude/CLAUDE.md` + the PostToolUse hook entry in
157
+ * `~/.claude/settings.json`; Gemini/Codex the inlined block in `~/.gemini/GEMINI.md` /
158
+ * `~/.codex/AGENTS.md` (Codex also gets the hook entry in `~/.codex/hooks.json`, with
159
+ * its two remaining manual steps printed). **Nothing is written into `cwd`.**
107
160
  * At `project` scope everything lands in `cwd`, exactly as it used to.
108
161
  *
109
162
  * Safe to call repeatedly: identical input leaves the tree byte-identical, and the
@@ -115,7 +168,42 @@ export declare function parseAgentType(value: string): AgentType | null;
115
168
  */
116
169
  export declare function installAgentSkills(cwd: string, agentType: AgentType, scope?: SkillScope, options?: {
117
170
  cleanProject?: boolean;
171
+ homeDir?: string;
118
172
  }): Promise<InstallTarget>;
173
+ /**
174
+ * What the drift check found in the installed config files, for tests and callers.
175
+ *
176
+ * `null` means: nothing to say — no agent detected, no config file, no OrbitMap block,
177
+ * or the installed block is already at (or beyond) this binary's version.
178
+ */
179
+ export interface InstructionsDrift {
180
+ /** Config file whose block is stale. */
181
+ configPath: string;
182
+ /** Version stamped in the installed START marker, or `null` for a pre-versioning block. */
183
+ installedVersion: string | null;
184
+ }
185
+ /**
186
+ * Detect whether the installed OrbitMap instruction block predates this binary.
187
+ *
188
+ * Locates the config file the way `setup-agent` does: `detectAgent(cwd)` names the agent,
189
+ * then the project-scope file is checked before the user-scope one (a project-level block
190
+ * shadows the user-level one in that directory, so it is the one actually being read).
191
+ * The first file that carries an OrbitMap block decides. Never writes anything.
192
+ *
193
+ * Returns `null` (silence) when: no agent is detectable, no config file carries a block,
194
+ * or the installed block's version is equal to or newer than `cliVersion`.
195
+ */
196
+ export declare function detectInstructionsDrift(cwd: string, cliVersion?: string, homeDir?: string): InstructionsDrift | null;
197
+ /** Test hook: forget that a drift warning was already printed in this process. */
198
+ export declare function resetInstructionsDriftWarning(): void;
199
+ /**
200
+ * One stderr line when the installed instructions predate this binary — nothing else.
201
+ *
202
+ * Called from exactly two commands (`orbitmap init`, `orbitmap context`) so there is no
203
+ * per-command tax. Never rewrites anything, never blocks, prints at most once per
204
+ * invocation, and goes to stderr so `--json` stdout stays parseable.
205
+ */
206
+ export declare function warnIfInstructionsDrift(cwd?: string, cliVersion?: string, homeDir?: string): void;
119
207
  export declare function setupAgentCommand(options: {
120
208
  agent?: string;
121
209
  scope?: string;