iosm-cli 0.1.2 → 0.2.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 (103) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +37 -3
  3. package/dist/cli/args.d.ts.map +1 -1
  4. package/dist/cli/args.js +4 -2
  5. package/dist/cli/args.js.map +1 -1
  6. package/dist/core/agent-profiles.d.ts.map +1 -1
  7. package/dist/core/agent-profiles.js +1 -0
  8. package/dist/core/agent-profiles.js.map +1 -1
  9. package/dist/core/agent-session.d.ts.map +1 -1
  10. package/dist/core/agent-session.js +3 -0
  11. package/dist/core/agent-session.js.map +1 -1
  12. package/dist/core/blast.d.ts +62 -0
  13. package/dist/core/blast.d.ts.map +1 -0
  14. package/dist/core/blast.js +448 -0
  15. package/dist/core/blast.js.map +1 -0
  16. package/dist/core/contract.d.ts +54 -0
  17. package/dist/core/contract.d.ts.map +1 -0
  18. package/dist/core/contract.js +300 -0
  19. package/dist/core/contract.js.map +1 -0
  20. package/dist/core/sdk.d.ts +3 -3
  21. package/dist/core/sdk.d.ts.map +1 -1
  22. package/dist/core/sdk.js +11 -19
  23. package/dist/core/sdk.js.map +1 -1
  24. package/dist/core/semantic/chunking.d.ts +10 -0
  25. package/dist/core/semantic/chunking.d.ts.map +1 -0
  26. package/dist/core/semantic/chunking.js +82 -0
  27. package/dist/core/semantic/chunking.js.map +1 -0
  28. package/dist/core/semantic/cli.d.ts +23 -0
  29. package/dist/core/semantic/cli.d.ts.map +1 -0
  30. package/dist/core/semantic/cli.js +86 -0
  31. package/dist/core/semantic/cli.js.map +1 -0
  32. package/dist/core/semantic/config.d.ts +8 -0
  33. package/dist/core/semantic/config.d.ts.map +1 -0
  34. package/dist/core/semantic/config.js +266 -0
  35. package/dist/core/semantic/config.js.map +1 -0
  36. package/dist/core/semantic/index-store.d.ts +21 -0
  37. package/dist/core/semantic/index-store.d.ts.map +1 -0
  38. package/dist/core/semantic/index-store.js +73 -0
  39. package/dist/core/semantic/index-store.js.map +1 -0
  40. package/dist/core/semantic/index.d.ts +8 -0
  41. package/dist/core/semantic/index.d.ts.map +1 -0
  42. package/dist/core/semantic/index.js +7 -0
  43. package/dist/core/semantic/index.js.map +1 -0
  44. package/dist/core/semantic/providers.d.ts +22 -0
  45. package/dist/core/semantic/providers.d.ts.map +1 -0
  46. package/dist/core/semantic/providers.js +317 -0
  47. package/dist/core/semantic/providers.js.map +1 -0
  48. package/dist/core/semantic/runtime.d.ts +32 -0
  49. package/dist/core/semantic/runtime.d.ts.map +1 -0
  50. package/dist/core/semantic/runtime.js +510 -0
  51. package/dist/core/semantic/runtime.js.map +1 -0
  52. package/dist/core/semantic/types.d.ts +157 -0
  53. package/dist/core/semantic/types.d.ts.map +1 -0
  54. package/dist/core/semantic/types.js +23 -0
  55. package/dist/core/semantic/types.js.map +1 -0
  56. package/dist/core/shadow-guard.d.ts +30 -0
  57. package/dist/core/shadow-guard.d.ts.map +1 -0
  58. package/dist/core/shadow-guard.js +81 -0
  59. package/dist/core/shadow-guard.js.map +1 -0
  60. package/dist/core/singular.d.ts +73 -0
  61. package/dist/core/singular.d.ts.map +1 -0
  62. package/dist/core/singular.js +413 -0
  63. package/dist/core/singular.js.map +1 -0
  64. package/dist/core/slash-commands.d.ts.map +1 -1
  65. package/dist/core/slash-commands.js +12 -0
  66. package/dist/core/slash-commands.js.map +1 -1
  67. package/dist/core/system-prompt.d.ts.map +1 -1
  68. package/dist/core/system-prompt.js +21 -3
  69. package/dist/core/system-prompt.js.map +1 -1
  70. package/dist/core/tools/ast-grep.js +1 -1
  71. package/dist/core/tools/ast-grep.js.map +1 -1
  72. package/dist/core/tools/comby.js +1 -1
  73. package/dist/core/tools/comby.js.map +1 -1
  74. package/dist/core/tools/index.d.ts +9 -0
  75. package/dist/core/tools/index.d.ts.map +1 -1
  76. package/dist/core/tools/index.js +6 -0
  77. package/dist/core/tools/index.js.map +1 -1
  78. package/dist/core/tools/rg.js +1 -1
  79. package/dist/core/tools/rg.js.map +1 -1
  80. package/dist/core/tools/semantic-search.d.ts +21 -0
  81. package/dist/core/tools/semantic-search.d.ts.map +1 -0
  82. package/dist/core/tools/semantic-search.js +123 -0
  83. package/dist/core/tools/semantic-search.js.map +1 -0
  84. package/dist/index.d.ts +4 -2
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.js +3 -2
  87. package/dist/index.js.map +1 -1
  88. package/dist/main.d.ts.map +1 -1
  89. package/dist/main.js +124 -0
  90. package/dist/main.js.map +1 -1
  91. package/dist/modes/interactive/components/custom-editor.d.ts +8 -0
  92. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  93. package/dist/modes/interactive/components/custom-editor.js +70 -1
  94. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  95. package/dist/modes/interactive/interactive-mode.d.ts +58 -0
  96. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  97. package/dist/modes/interactive/interactive-mode.js +2067 -104
  98. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  99. package/docs/cli-reference.md +36 -1
  100. package/docs/configuration.md +79 -2
  101. package/docs/getting-started.md +1 -0
  102. package/docs/interactive-mode.md +135 -1
  103. package/package.json +1 -1
@@ -98,6 +98,40 @@ View and manage configuration.
98
98
  iosm config
99
99
  ```
100
100
 
101
+ ### `iosm semantic`
102
+
103
+ Semantic index management for meaning-based retrieval.
104
+
105
+ ```bash
106
+ iosm semantic help
107
+ iosm semantic status
108
+ iosm semantic index
109
+ iosm semantic rebuild
110
+ iosm semantic query "<text>" [--top-k N]
111
+ ```
112
+
113
+ Notes:
114
+ - If semantic config is missing, the command prints actionable paths and suggests `/semantic setup`.
115
+ - `query` auto-refreshes stale indexes only when `semanticSearch.autoIndex=true` (default is `true`).
116
+ - When auto-index is off, run `iosm semantic index` (or `rebuild` for provider/chunk/filter changes).
117
+
118
+ ### Interactive feasibility/contract commands
119
+
120
+ These commands run inside interactive mode (`iosm`), not as top-level CLI subcommands:
121
+
122
+ - `/contract` — interactive engineering contract manager:
123
+ - edit fields one-by-one
124
+ - autosave on `Enter`
125
+ - auto-build `.iosm/contract.json` for project scope
126
+ - `/singular <feature request>` — command-first feasibility analyzer:
127
+ - baseline repository scan + standard agent pass
128
+ - outputs exactly 3 implementation options with recommendation
129
+ - lets user choose option `1/2/3` before implementation
130
+
131
+ Migration notes:
132
+ - `/blast` removed in favor of `/singular`
133
+ - `/shadow` removed
134
+
101
135
  ---
102
136
 
103
137
  ## Core Options
@@ -209,12 +243,13 @@ iosm --api-key sk-test-123 # Override for this run
209
243
 
210
244
  ### Available Tools
211
245
 
212
- `read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`, `rg`, `fd`, `ast_grep`, `comby`, `jq`, `yq`, `semgrep`, `sed`
246
+ `read`, `bash`, `edit`, `write`, `grep`, `find`, `ls`, `rg`, `fd`, `ast_grep`, `comby`, `jq`, `yq`, `semgrep`, `sed`, `semantic_search`
213
247
 
214
248
  Tool notes:
215
249
  - `rg`, `fd` are managed by iosm-cli and auto-resolved when missing.
216
250
  - `ast_grep`, `comby`, `jq`, `yq`, `semgrep` are optional external CLIs and should be available in `PATH` to use their tools.
217
251
  - `sed` tool is preview/extraction-oriented; in-place edits are intentionally blocked.
252
+ - `semantic_search` uses configured embeddings provider/index (`/semantic setup`).
218
253
 
219
254
  **Examples:**
220
255
 
@@ -12,6 +12,7 @@ Complete reference for `iosm-cli` settings, environment variables, profiles, and
12
12
  ~/.iosm/agent/
13
13
  ├── settings.json # Global settings
14
14
  ├── mcp.json # User MCP servers
15
+ ├── semantic.json # User semantic search config
15
16
  ├── models.json # Model configuration and preferences
16
17
  ├── auth.json # Provider credentials (OAuth + API keys via /login)
17
18
  ├── keybindings.json # Custom keyboard shortcuts
@@ -28,6 +29,7 @@ Complete reference for `iosm-cli` settings, environment variables, profiles, and
28
29
  ```
29
30
  .iosm/
30
31
  ├── settings.json # Project-specific settings
32
+ ├── semantic.json # Project semantic search overrides
31
33
  ├── extensions/ # Project extensions
32
34
  ├── skills/ # Project skills
33
35
  ├── prompts/ # Project prompt templates
@@ -105,6 +107,81 @@ MCP configs are loaded with project override precedence:
105
107
 
106
108
  ---
107
109
 
110
+ ## Semantic Search Configuration
111
+
112
+ Semantic search is configured separately from settings and supports user/project override merge:
113
+
114
+ 1. `~/.iosm/agent/semantic.json`
115
+ 2. `.iosm/semantic.json` (project root, overrides user)
116
+
117
+ Interactive setup:
118
+
119
+ ```bash
120
+ /semantic setup
121
+ ```
122
+
123
+ CLI actions:
124
+
125
+ ```bash
126
+ iosm semantic status
127
+ iosm semantic index
128
+ iosm semantic query "where auth token is validated" --top-k 8
129
+ iosm semantic rebuild
130
+ ```
131
+
132
+ Schema (`semanticSearch` object):
133
+
134
+ ```json
135
+ {
136
+ "semanticSearch": {
137
+ "enabled": true,
138
+ "autoIndex": true,
139
+ "provider": {
140
+ "type": "openrouter",
141
+ "model": "openai/text-embedding-3-small",
142
+ "baseUrl": "optional",
143
+ "apiKeyEnv": "optional",
144
+ "headers": {
145
+ "KEY": "VALUE"
146
+ },
147
+ "batchSize": 32,
148
+ "timeoutMs": 30000
149
+ },
150
+ "index": {
151
+ "includeGlobs": [
152
+ "**/*.{ts,tsx,js,jsx,py,go,rs,java,md,json,yaml,yml}"
153
+ ],
154
+ "excludeGlobs": [
155
+ "**/.git/**",
156
+ "**/node_modules/**",
157
+ "**/dist/**",
158
+ "**/build/**",
159
+ "**/.iosm/**"
160
+ ],
161
+ "chunkMaxChars": 1200,
162
+ "chunkOverlapChars": 200,
163
+ "maxFileBytes": 262144,
164
+ "maxFiles": 20000
165
+ }
166
+ }
167
+ }
168
+ ```
169
+
170
+ `autoIndex` controls query-time automatic refresh:
171
+ - `true` (default): `query` automatically refreshes stale index (and rebuilds when required)
172
+ - `false`: stale/missing index must be updated manually via `iosm semantic index` / `rebuild`
173
+
174
+ Index storage (global cache):
175
+
176
+ ```
177
+ ~/.iosm/agent/semantic/indexes/<project-hash>/
178
+ ├── meta.json
179
+ ├── chunks.jsonl
180
+ └── vectors.jsonl
181
+ ```
182
+
183
+ ---
184
+
108
185
  ## Environment Variables
109
186
 
110
187
  ### Provider API Keys
@@ -118,7 +195,7 @@ MCP configs are loaded with project override precedence:
118
195
  | `GROQ_API_KEY` | Groq | |
119
196
  | `CEREBRAS_API_KEY` | Cerebras | |
120
197
  | `XAI_API_KEY` | xAI (Grok) | |
121
- | `OPENROUTER_API_KEY` | OpenRouter | Multi-provider gateway |
198
+ | `OPENROUTER_API_KEY` | OpenRouter | Multi-provider gateway + default semantic embeddings key |
122
199
  | `MISTRAL_API_KEY` | Mistral | |
123
200
  | `MINIMAX_API_KEY` | MiniMax | |
124
201
  | `KIMI_API_KEY` | Kimi | |
@@ -165,7 +242,7 @@ Profiles control the agent's behavior, available tools, and system prompt.
165
242
 
166
243
  | Profile | Tools | Behavior |
167
244
  |---------|-------|----------|
168
- | `full` | All built-ins (read, bash, edit, write, grep, find, ls, rg, fd, ast_grep, comby, jq, yq, semgrep, sed) | Default full development capabilities |
245
+ | `full` | All built-ins (read, bash, edit, write, grep, find, ls, rg, fd, ast_grep, comby, jq, yq, semgrep, sed, semantic_search) | Default full development capabilities |
169
246
  | `plan` | Read-only (read, grep, find, ls) | Architecture planning and code review |
170
247
  | `iosm` | All + IOSM context | IOSM cycle execution with artifact synchronization |
171
248
 
@@ -92,6 +92,7 @@ You'll see a prompt where you can type messages. The agent has access to your fi
92
92
  |---------|-------------|
93
93
  | `/model` | Pick or change the active model |
94
94
  | `/login` | Authenticate with OAuth providers (including Qwen) or add OpenRouter API key |
95
+ | `/semantic` | Configure semantic provider and index/query meaning-based code search |
95
96
  | `/init` | Bootstrap IOSM artifacts for the current project |
96
97
  | `/agents` | View available custom/system agents |
97
98
  | `/settings` | View and modify settings |
@@ -53,6 +53,9 @@ iosm --continue
53
53
  | `/model` | Open provider-first model selector (`provider -> model`) | `/model` |
54
54
  | `/scoped-models` | Manage model rotation | `/scoped-models` |
55
55
  | `/mcp` | Open MCP manager UI and run MCP subcommands | `/mcp` |
56
+ | `/semantic` | Open semantic search manager (`setup/auto-index/status/index/rebuild/query`) | `/semantic` |
57
+ | `/contract` | Interactive engineering contract editor (field-by-field, auto JSON build) | `/contract` |
58
+ | `/singular` | Feature feasibility analyzer with implementation options and recommendation | `/singular add account dashboard` |
56
59
  | `/memory` | Interactive memory manager (`add/edit/remove/scope/path`) | `/memory` |
57
60
  | `/settings` | View/modify settings | `/settings` |
58
61
  | `/hotkeys` | View keyboard shortcuts | `/hotkeys` |
@@ -97,7 +100,138 @@ iosm --continue
97
100
  | `/logout` | Clear saved provider credentials | `/logout` |
98
101
 
99
102
  `/mcp add` without flags starts a guided wizard in the terminal UI.
103
+ `/semantic` opens an interactive setup/status/index/query manager for embeddings search.
104
+ Manager includes `Automatic indexing` toggle (default `on`) to control query-time auto-refresh.
105
+ `/semantic setup` now auto-loads model catalogs for OpenRouter (`/api/v1/embeddings/models`) and Ollama (`/api/tags`) with manual fallback.
106
+ In `/semantic setup`, the headers step is optional: press `Enter` on empty input to skip.
100
107
  `/memory` opens an interactive manager. `/memory <text>` saves a note to `memory.md` and reloads session context. Use `/memory edit <index> <text>` for direct updates.
108
+ `/contract` edits contract fields interactively (`goal`, scope, constraints, quality gates, DoD, risks, etc.), then writes JSON automatically.
109
+ `/singular <request>` runs a two-pass feasibility analysis (baseline scan + standard agent pass), builds concrete implementation options, and asks user to choose one.
110
+ `/blast` and `/shadow` are removed from active interactive workflow.
111
+
112
+ ### `/contract` Detailed Guide
113
+
114
+ `/contract` is a layered contract editor with two sources and one merged output:
115
+
116
+ | Layer | Scope | Persistence | Storage |
117
+ |------|-------|-------------|---------|
118
+ | `project` | Project-wide baseline | Persistent | `.iosm/contract.json` |
119
+ | `session` | Current session override | Temporary | In-memory session overlay |
120
+ | `effective` | `project + session` merged result | Derived | Computed at runtime |
121
+
122
+ Important merge rule:
123
+ - `session` overrides `project` for the same keys.
124
+ - `effective` is what the runtime actually uses.
125
+
126
+ #### Quick Difference: Effective vs Session vs Project
127
+
128
+ - `Open effective contract` is read-only and shows what runtime is enforcing right now.
129
+ - `Edit session contract` changes only this session (temporary overlay, not persisted to disk).
130
+ - `Edit project contract` changes `.iosm/contract.json` (persistent baseline for future sessions).
131
+
132
+ #### Manager Actions
133
+
134
+ | Action | What it does | When to use |
135
+ |------|---------------|-------------|
136
+ | `Open effective contract` | Shows the merged JSON currently enforced by runtime | Verify final active constraints |
137
+ | `Edit session contract` | Edits temporary overrides for current session | Experiments, one-off constraints |
138
+ | `Edit project contract` | Edits persistent project contract file | Team-wide stable defaults |
139
+ | `Copy effective -> session` | Saves merged state into session layer | Freeze current merged state for this run |
140
+ | `Copy effective -> project` | Saves merged state into project file | Promote temporary decisions to baseline |
141
+ | `Delete session contract` | Clears temporary overlay | Reset session overrides |
142
+ | `Delete project contract` | Removes `.iosm/contract.json` | Full baseline reset |
143
+
144
+ #### Field Editor Behavior
145
+
146
+ - Select a field and press `Enter`.
147
+ - Input text (single-line or multi-line list depending on field type).
148
+ - Press `Enter` to submit.
149
+ - Change is saved immediately to selected scope (`session` or `project`).
150
+ - Empty input clears that field.
151
+
152
+ There is no separate "Save" step in field editor mode.
153
+
154
+ #### Common Workflows
155
+
156
+ 1. Temporary tightening for one run:
157
+ - Open `/contract`
158
+ - `Edit session contract`
159
+ - Set `constraints` and `quality_gates`
160
+ - Confirm via `Open effective contract`
161
+
162
+ 2. Promote temporary policy to project baseline:
163
+ - Open `/contract`
164
+ - `Copy effective -> project`
165
+ - Review `.iosm/contract.json` in VCS
166
+
167
+ 3. Recover from aggressive temporary overrides:
168
+ - Open `/contract`
169
+ - `Delete session contract`
170
+ - Re-open `effective` and verify fallback to `project`
171
+
172
+ ### `/singular` Detailed Guide
173
+
174
+ `/singular` is a command-first feasibility mode (no pre-menu).
175
+ Pattern: `/singular <feature request>`
176
+
177
+ Examples:
178
+ - `/singular add account dashboard`
179
+ - `/singular introduce RBAC for API`
180
+ - `/singular redesign billing reconciliation flow`
181
+
182
+ #### What Happens Internally
183
+
184
+ 1. Baseline repository pass:
185
+ - Scans project files and estimates baseline complexity/blast radius.
186
+ - Collects likely impacted files and contract signals.
187
+
188
+ 2. Standard agent feasibility pass:
189
+ - Launches an isolated standard agent run (`plan` profile) with repository tools.
190
+ - Agent inspects real files and returns structured feasibility JSON.
191
+ - Produces recommendation, impact analysis, and implementation variants.
192
+
193
+ 3. Merge + persistence:
194
+ - Agent insights are merged with baseline data.
195
+ - Analysis is saved to `.iosm/singular/<run-id>/analysis.json` (+ `meta.json`).
196
+
197
+ #### Output Shape
198
+
199
+ Each run includes:
200
+ - `recommendation`: `implement_now | implement_incrementally | defer`
201
+ - `reason`: why this recommendation is best for current stage
202
+ - `complexity` and `blast_radius`
203
+ - `stage_fit`: `needed_now | optional_now | later`
204
+ - `impact_analysis`: codebase, delivery, risks, operations
205
+ - `implementation_options` (exactly 3 variants):
206
+ - Option 1: practical/recommended path
207
+ - Option 2: alternative approach
208
+ - Option 3: defer / do not implement now
209
+
210
+ Each option includes:
211
+ - summary and trade-offs (`pros`/`cons`)
212
+ - concrete file targets (`suggested_files`)
213
+ - step-by-step plan (`plan`)
214
+ - `when_to_choose` guidance
215
+
216
+ #### Decision Flow
217
+
218
+ After analysis, selector opens with variants:
219
+ - choose Option 1 / Option 2 / Option 3
220
+ - or close without decision
221
+
222
+ If Option 1 or 2 is selected, execution draft is inserted into editor (ready to run).
223
+ If Option 3 is selected, run is explicitly marked as postponed.
224
+
225
+ #### Fallback Behavior
226
+
227
+ If no model is selected (or agent pass fails), `/singular` still returns a heuristic baseline analysis.
228
+ Use `/model` to enable full agent feasibility pass.
229
+
230
+ #### Command Migration
231
+
232
+ - `/singular` is the feasibility command to use.
233
+ - `/blast` is deprecated/removed.
234
+ - `/shadow` is removed.
101
235
 
102
236
  ---
103
237
 
@@ -161,7 +295,7 @@ Profiles change the agent's behavior, available tools, and system prompt:
161
295
 
162
296
  | Profile | Tools | Use Case |
163
297
  |---------|-------|----------|
164
- | `full` | All built-ins (read, bash, edit, write, grep, find, ls, rg, fd, ast_grep, comby, jq, yq, semgrep, sed) | Default development work |
298
+ | `full` | All built-ins (read, bash, edit, write, grep, find, ls, rg, fd, ast_grep, comby, jq, yq, semgrep, sed, semantic_search) | Default development work |
165
299
  | `plan` | Read-only (read, grep, find, ls) | Architecture planning, code review |
166
300
  | `iosm` | All + IOSM context | IOSM cycle execution with artifact sync |
167
301
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iosm-cli",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "Standalone IOSM CLI with agent tooling, session management, and IOSM artifact orchestration",
5
5
  "type": "module",
6
6
  "iosmConfig": {