@pugi/cli 0.1.0-beta.9 → 0.1.0-beta.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +132 -0
- package/LICENSE +1 -1
- package/assets/pugi-prozr2-mascot.ansi +9 -0
- package/bin/run.js +33 -1
- package/dist/commands/deploy.js +40 -40
- package/dist/commands/flatten.js +191 -0
- package/dist/commands/jobs-watch.js +201 -0
- package/dist/commands/jobs.js +42 -27
- package/dist/commands/smoke.js +133 -0
- package/dist/core/agent-progress/cleanup.js +134 -0
- package/dist/core/agent-progress/schema.js +144 -0
- package/dist/core/agent-progress/writer.js +101 -0
- package/dist/core/agents/adaptive-router.js +330 -0
- package/dist/core/agents/query-decomposer.js +297 -0
- package/dist/core/agents/registry.js +3 -3
- package/dist/core/approvals/shortcut-resolver.js +98 -0
- package/dist/core/artifact-chain/dispatcher.js +148 -0
- package/dist/core/artifact-chain/exporter.js +164 -0
- package/dist/core/artifact-chain/state.js +243 -0
- package/dist/core/artifact-chain/steps.js +169 -0
- package/dist/core/ask-user/question.js +92 -0
- package/dist/core/audit/audit-trail.js +275 -0
- package/dist/core/auth/ensure-authenticated.js +129 -0
- package/dist/core/auth/env-provider.js +238 -0
- package/dist/core/auto-open-browser.js +4 -4
- package/dist/core/auto-update/channels.js +122 -0
- package/dist/core/auto-update/checker.js +241 -0
- package/dist/core/auto-update/state.js +235 -0
- package/dist/core/bare-mode/index.js +107 -0
- package/dist/core/bash/redirect.js +281 -0
- package/dist/core/bash-classifier.js +436 -40
- package/dist/core/checkpoint/resumer.js +149 -0
- package/dist/core/checkpoint/rewinder.js +291 -0
- package/dist/core/checkpoints/shadow-git.js +670 -0
- package/dist/core/citations/parser.js +109 -0
- package/dist/core/classifier/yolo-classifier.js +88 -0
- package/dist/core/codegraph/decision-store.js +248 -0
- package/dist/core/codegraph/detect-repo.js +459 -0
- package/dist/core/codegraph/install.js +134 -0
- package/dist/core/codegraph/offer-hook.js +220 -0
- package/dist/core/compact/auto-trigger.js +96 -0
- package/dist/core/compact/buffer-rewriter.js +115 -0
- package/dist/core/compact/summarizer.js +208 -0
- package/dist/core/compact/token-counter.js +108 -0
- package/dist/core/consensus/anvil-fanout.js +25 -25
- package/dist/core/consensus/diff-capture.js +121 -12
- package/dist/core/consensus/rubric.js +21 -21
- package/dist/core/context/builder.js +6 -6
- package/dist/core/context/compaction-events.js +8 -8
- package/dist/core/context/compaction.js +31 -31
- package/dist/core/context/index.js +15 -8
- package/dist/core/context/invariants.js +51 -51
- package/dist/core/context/markdown-loader.js +28 -10
- package/dist/core/context/markdown-traverse.js +255 -0
- package/dist/core/context/pugiignore.js +41 -41
- package/dist/core/context/repo-skeleton.js +37 -37
- package/dist/core/context/tool-eviction.js +55 -0
- package/dist/core/context/watcher.js +32 -32
- package/dist/core/context/working-set.js +23 -23
- package/dist/core/coordinator/agent-tools.js +77 -0
- package/dist/core/coordinator/agent-toolset.js +65 -0
- package/dist/core/coordinator/fsm.js +73 -0
- package/dist/core/coordinator/mode-fsm.js +70 -0
- package/dist/core/cost/rate-card.js +129 -0
- package/dist/core/cost/tracker.js +221 -0
- package/dist/core/credentials.js +13 -13
- package/dist/core/cron/scheduler.js +138 -0
- package/dist/core/denial-tracking/index.js +8 -0
- package/dist/core/denial-tracking/state.js +264 -0
- package/dist/core/diagnostics/probe-runner.js +93 -0
- package/dist/core/diagnostics/probes/api.js +46 -0
- package/dist/core/diagnostics/probes/auth.js +93 -0
- package/dist/core/diagnostics/probes/bare-mode.js +42 -0
- package/dist/core/diagnostics/probes/cli-version.js +127 -0
- package/dist/core/diagnostics/probes/config.js +72 -0
- package/dist/core/diagnostics/probes/denial-tracking.js +57 -0
- package/dist/core/diagnostics/probes/disk.js +81 -0
- package/dist/core/diagnostics/probes/engine-live.js +46 -0
- package/dist/core/diagnostics/probes/git.js +65 -0
- package/dist/core/diagnostics/probes/hooks.js +118 -0
- package/dist/core/diagnostics/probes/mcp.js +75 -0
- package/dist/core/diagnostics/probes/node.js +59 -0
- package/dist/core/diagnostics/probes/pnpm.js +36 -0
- package/dist/core/diagnostics/probes/pugi-md.js +89 -0
- package/dist/core/diagnostics/probes/sandbox.js +40 -0
- package/dist/core/diagnostics/probes/session.js +74 -0
- package/dist/core/diagnostics/probes/status-snapshot.js +488 -0
- package/dist/core/diagnostics/probes/workspace.js +63 -0
- package/dist/core/diagnostics/types.js +70 -0
- package/dist/core/dispatch/cache-cleanup.js +197 -0
- package/dist/core/dispatch/cache-handoff.js +295 -0
- package/dist/core/edits/apply-patch-layer-e.js +189 -0
- package/dist/core/edits/dispatch.js +333 -7
- package/dist/core/edits/format-detector.js +260 -0
- package/dist/core/edits/format-matrix.js +26 -0
- package/dist/core/edits/fuzzy-ladder.js +650 -0
- package/dist/core/edits/index.js +5 -1
- package/dist/core/edits/journal.js +199 -0
- package/dist/core/edits/layer-a-apply.js +15 -15
- package/dist/core/edits/layer-a-fuzzy-apply.js +198 -0
- package/dist/core/edits/layer-b-apply.js +9 -9
- package/dist/core/edits/layer-c-apply.js +6 -6
- package/dist/core/edits/layer-d-ast.js +557 -14
- package/dist/core/edits/marker-parser.js +12 -12
- package/dist/core/edits/security-gate.js +27 -27
- package/dist/core/edits/verify-hook.js +273 -0
- package/dist/core/edits/worktree.js +29 -29
- package/dist/core/engine/anvil-client.js +214 -26
- package/dist/core/engine/auto-compact.js +179 -0
- package/dist/core/engine/budgets.js +186 -0
- package/dist/core/engine/context-prefix.js +155 -0
- package/dist/core/engine/index.js +1 -1
- package/dist/core/engine/intensity.js +158 -0
- package/dist/core/engine/intent.js +260 -0
- package/dist/core/engine/native-pugi.js +1295 -227
- package/dist/core/engine/prompts.js +129 -19
- package/dist/core/engine/strip-internal-fields.js +124 -0
- package/dist/core/engine/tool-bridge.js +1792 -59
- package/dist/core/evaluation/golden-dataset.js +293 -0
- package/dist/core/feedback/queue.js +177 -0
- package/dist/core/feedback/submitter.js +145 -0
- package/dist/core/file-cache.js +113 -1
- package/dist/core/flatten/flatten-repo.js +439 -0
- package/dist/core/format/osc8-link.js +28 -0
- package/dist/core/hook-chains.js +392 -0
- package/dist/core/hooks/citation-verify-hook.js +138 -0
- package/dist/core/hooks/citation-verify.js +112 -0
- package/dist/core/hooks/events.js +46 -0
- package/dist/core/hooks/index.js +15 -0
- package/dist/core/hooks/registry.js +216 -0
- package/dist/core/hooks/runner.js +236 -0
- package/dist/core/hooks/v2/event-emitter.js +115 -0
- package/dist/core/hooks/v2/executor.js +282 -0
- package/dist/core/hooks/v2/index.js +25 -0
- package/dist/core/hooks/v2/lifecycle.js +104 -0
- package/dist/core/hooks/v2/loader.js +216 -0
- package/dist/core/hooks/v2/matcher.js +125 -0
- package/dist/core/hooks/v2/trust.js +143 -0
- package/dist/core/hooks/v2/types.js +86 -0
- package/dist/core/hooks/worktree-events.js +158 -0
- package/dist/core/image/renderer.js +71 -0
- package/dist/core/init/detector.js +582 -0
- package/dist/core/init/template-renderer.js +242 -0
- package/dist/core/jobs/registry.js +18 -18
- package/dist/core/ledger/results-tsv.js +142 -0
- package/dist/core/log-discipline/stdout-redirect.js +51 -0
- package/dist/core/lsp/cache.js +105 -0
- package/dist/core/lsp/client.js +551 -41
- package/dist/core/lsp/language-detect.js +66 -0
- package/dist/core/lsp/post-edit-diagnostics.js +171 -0
- package/dist/core/lsp/server-detect.js +173 -0
- package/dist/core/lsp/symbol-cache.js +162 -0
- package/dist/core/lsp/symbol-tools.js +664 -0
- package/dist/core/mcp/client.js +97 -28
- package/dist/core/mcp/http-server.js +553 -0
- package/dist/core/mcp/orchestrator-tools.js +662 -0
- package/dist/core/mcp/permission.js +190 -0
- package/dist/core/mcp/registry.js +39 -17
- package/dist/core/mcp/server-tools.js +219 -0
- package/dist/core/mcp/server.js +397 -0
- package/dist/core/mcp/trust.js +10 -10
- package/dist/core/memory/dual-write.js +416 -0
- package/dist/core/memory/passive-extract.js +130 -0
- package/dist/core/memory/phase1-kinds.js +20 -0
- package/dist/core/memory/secret-scanner.js +304 -0
- package/dist/core/memory-sync/queue.js +170 -0
- package/dist/core/metrics/extract.js +113 -0
- package/dist/core/modes/roo-modes.js +68 -0
- package/dist/core/onboarding/ensure-initialized.js +133 -0
- package/dist/core/onboarding/marker.js +111 -0
- package/dist/core/onboarding/telemetry-state.js +108 -0
- package/dist/core/output-style/presets.js +176 -0
- package/dist/core/output-style/state.js +185 -0
- package/dist/core/path-security.js +287 -5
- package/dist/core/permission.js +82 -22
- package/dist/core/permissions/auto-classifier.js +124 -0
- package/dist/core/permissions/bash-parser.js +371 -0
- package/dist/core/permissions/circuit-breaker.js +83 -0
- package/dist/core/permissions/constrained-edit.js +91 -0
- package/dist/core/permissions/gate.js +278 -0
- package/dist/core/permissions/index.js +20 -0
- package/dist/core/permissions/mode.js +174 -0
- package/dist/core/permissions/network-egress.js +137 -0
- package/dist/core/permissions/state.js +241 -0
- package/dist/core/permissions/tool-class.js +93 -0
- package/dist/core/plan-mode/ui-state.js +51 -0
- package/dist/core/plans/plan-artifact.js +721 -0
- package/dist/core/policy-limits/etag-store.js +122 -0
- package/dist/core/prd-check/parser.js +215 -0
- package/dist/core/prd-check/reporter.js +127 -0
- package/dist/core/prd-check/session-review.js +557 -0
- package/dist/core/prd-check/verifiers.js +223 -0
- package/dist/core/prompt-cache/client-cache.js +99 -0
- package/dist/core/prompts/assembly.js +29 -0
- package/dist/core/prompts/registry.js +364 -0
- package/dist/core/pugi-md/cc-compat-rules.js +735 -0
- package/dist/core/pugi-md/context-injector.js +76 -0
- package/dist/core/pugi-md/walk-up.js +207 -0
- package/dist/core/python/uv-installer.js +270 -0
- package/dist/core/python/uv-resolver.js +83 -0
- package/dist/core/rate-limit/narrator.js +146 -0
- package/dist/core/recipes/cli-types.js +20 -0
- package/dist/core/recipes/loader.js +103 -0
- package/dist/core/recipes/runner.js +345 -0
- package/dist/core/recipes/schema.js +587 -0
- package/dist/core/release-notes/parser.js +241 -0
- package/dist/core/release-notes/state.js +116 -0
- package/dist/core/repl/ask.js +37 -37
- package/dist/core/repl/cancellation.js +26 -26
- package/dist/core/repl/cap-warning.js +4 -4
- package/dist/core/repl/clipboard-read.js +11 -11
- package/dist/core/repl/dispatch-fsm.js +12 -12
- package/dist/core/repl/history-search.js +15 -15
- package/dist/core/repl/history.js +28 -18
- package/dist/core/repl/kill-ring.js +5 -5
- package/dist/core/repl/model-pricing.js +135 -0
- package/dist/core/repl/privacy-banner.js +22 -22
- package/dist/core/repl/session.js +2148 -217
- package/dist/core/repl/slash-commands.js +501 -41
- package/dist/core/repl/store/index.js +1 -1
- package/dist/core/repl/store/jsonl-log.js +22 -22
- package/dist/core/repl/store/lockfile.js +10 -10
- package/dist/core/repl/store/session-store.js +136 -107
- package/dist/core/repl/store/types.js +15 -15
- package/dist/core/repl/store/uuid-v7.js +12 -12
- package/dist/core/repl/workspace-context.js +43 -21
- package/dist/core/repo-map/build.js +125 -0
- package/dist/core/repo-map/cache.js +185 -0
- package/dist/core/repo-map/extractor.js +254 -0
- package/dist/core/repo-map/formatter.js +145 -0
- package/dist/core/repo-map/page-rank.js +105 -0
- package/dist/core/repo-map/scanner.js +211 -0
- package/dist/core/retry-budget/budget.js +284 -0
- package/dist/core/retry-budget/index.js +5 -0
- package/dist/core/retry-budget/retry-cap.js +74 -0
- package/dist/core/routing/lead-worker.js +43 -0
- package/dist/core/routing/pre-flight-estimator.js +108 -0
- package/dist/core/runs/run-tree.js +103 -0
- package/dist/core/security/injection-scanner.js +367 -0
- package/dist/core/security/output-filter.js +418 -0
- package/dist/core/session/env-file.js +105 -0
- package/dist/core/session/section-budgets.js +140 -0
- package/dist/core/session.js +92 -0
- package/dist/core/settings.js +324 -5
- package/dist/core/share/formatter.js +271 -0
- package/dist/core/share/redactor.js +221 -0
- package/dist/core/share/uploader.js +267 -0
- package/dist/core/skills/defaults.js +30 -30
- package/dist/core/skills/loader.js +22 -22
- package/dist/core/skills/sources.js +27 -27
- package/dist/core/smoke/headless-driver.js +174 -0
- package/dist/core/smoke/orchestrator.js +194 -0
- package/dist/core/smoke/runner.js +238 -0
- package/dist/core/smoke/scenario-parser.js +316 -0
- package/dist/core/statusline.js +99 -0
- package/dist/core/subagents/dispatcher-real.js +600 -0
- package/dist/core/subagents/dispatcher.js +132 -43
- package/dist/core/subagents/index.js +19 -6
- package/dist/core/subagents/isolation-matrix.js +213 -0
- package/dist/core/subagents/spawn.js +19 -4
- package/dist/core/telemetry/emitter.js +229 -0
- package/dist/core/telemetry/queue.js +251 -0
- package/dist/core/theme/context.js +91 -0
- package/dist/core/theme/presets.js +228 -0
- package/dist/core/theme/state.js +181 -0
- package/dist/core/todos/invariant.js +10 -0
- package/dist/core/todos/state.js +177 -0
- package/dist/core/tool-schema/compressor.js +89 -0
- package/dist/core/transport/version-interceptor.js +166 -0
- package/dist/core/trust.js +2 -2
- package/dist/core/tui/thinking-block.js +64 -0
- package/dist/core/vim/keymap.js +288 -0
- package/dist/core/vim/state.js +92 -0
- package/dist/core/watch-markers/marker-watcher.js +133 -0
- package/dist/core/worktree/include-parser.js +249 -0
- package/dist/core/worktree-manager/cleanup.js +123 -0
- package/dist/core/worktree-manager/manager.js +303 -0
- package/dist/index.js +36 -0
- package/dist/runtime/bootstrap.js +190 -0
- package/dist/runtime/cli.js +4185 -549
- package/dist/runtime/commands/agents.js +31 -31
- package/dist/runtime/commands/budget.js +5 -5
- package/dist/runtime/commands/cancel.js +231 -0
- package/dist/runtime/commands/chain.js +489 -0
- package/dist/runtime/commands/codegraph-status.js +227 -0
- package/dist/runtime/commands/compact.js +297 -0
- package/dist/runtime/commands/config.js +73 -39
- package/dist/runtime/commands/cost.js +199 -0
- package/dist/runtime/commands/delegate.js +27 -4
- package/dist/runtime/commands/dispatch.js +126 -0
- package/dist/runtime/commands/doctor.js +579 -0
- package/dist/runtime/commands/feedback.js +184 -0
- package/dist/runtime/commands/hooks.js +187 -0
- package/dist/runtime/commands/init.js +254 -0
- package/dist/runtime/commands/lsp.js +200 -38
- package/dist/runtime/commands/mcp.js +879 -0
- package/dist/runtime/commands/memory.js +582 -0
- package/dist/runtime/commands/model.js +237 -0
- package/dist/runtime/commands/onboarding.js +275 -0
- package/dist/runtime/commands/patch.js +12 -12
- package/dist/runtime/commands/permissions.js +112 -0
- package/dist/runtime/commands/plan.js +143 -0
- package/dist/runtime/commands/prd-check.js +285 -0
- package/dist/runtime/commands/privacy.js +17 -17
- package/dist/runtime/commands/recipe.js +325 -0
- package/dist/runtime/commands/redo-blob-store.js +92 -0
- package/dist/runtime/commands/redo.js +361 -0
- package/dist/runtime/commands/release-notes.js +229 -0
- package/dist/runtime/commands/repo-map.js +95 -0
- package/dist/runtime/commands/report.js +299 -0
- package/dist/runtime/commands/resume.js +118 -0
- package/dist/runtime/commands/review-consensus.js +68 -53
- package/dist/runtime/commands/rewind.js +333 -0
- package/dist/runtime/commands/roster.js +14 -14
- package/dist/runtime/commands/sessions.js +163 -0
- package/dist/runtime/commands/share.js +316 -0
- package/dist/runtime/commands/skills.js +31 -31
- package/dist/runtime/commands/status.js +186 -0
- package/dist/runtime/commands/stickers.js +82 -0
- package/dist/runtime/commands/style.js +194 -0
- package/dist/runtime/commands/theme.js +196 -0
- package/dist/runtime/commands/undo.js +54 -22
- package/dist/runtime/commands/update.js +289 -0
- package/dist/runtime/commands/vim.js +140 -0
- package/dist/runtime/commands/worktree.js +8 -8
- package/dist/runtime/commands/worktrees.js +155 -0
- package/dist/runtime/headless-repl.js +195 -0
- package/dist/runtime/headless.js +543 -0
- package/dist/runtime/load-hooks-or-exit.js +71 -0
- package/dist/runtime/plan-decompose.js +22 -22
- package/dist/runtime/sigint-guard.js +272 -0
- package/dist/runtime/update-check.js +28 -28
- package/dist/runtime/version.js +65 -0
- package/dist/runtime/worktree-bootstrap.js +579 -0
- package/dist/skills/bundled/batch.js +617 -0
- package/dist/skills/bundled/index.js +45 -0
- package/dist/skills/bundled/loop.js +358 -0
- package/dist/skills/bundled/remember.js +383 -0
- package/dist/skills/bundled/simplify.js +289 -0
- package/dist/skills/bundled/skillify.js +373 -0
- package/dist/skills/bundled/stuck.js +558 -0
- package/dist/skills/bundled/verify.js +439 -0
- package/dist/testing/vcr.js +486 -0
- package/dist/tools/agent-tool.js +229 -0
- package/dist/tools/apply-patch.js +89 -28
- package/dist/tools/ask-user-question.js +337 -0
- package/dist/tools/ask-user.js +115 -0
- package/dist/tools/bash.js +624 -46
- package/dist/tools/brief.js +224 -0
- package/dist/tools/cron.js +433 -0
- package/dist/tools/enter-worktree.js +250 -0
- package/dist/tools/exit-worktree.js +147 -0
- package/dist/tools/file-tools.js +161 -44
- package/dist/tools/lsp-tools.js +377 -1
- package/dist/tools/mcp-tool.js +260 -0
- package/dist/tools/multi-edit.js +361 -0
- package/dist/tools/powershell.js +268 -0
- package/dist/tools/registry.js +99 -4
- package/dist/tools/skill-tool.js +96 -0
- package/dist/tools/sleep.js +99 -0
- package/dist/tools/synthetic-output.js +133 -0
- package/dist/tools/tasks.js +208 -0
- package/dist/tools/todo-write.js +184 -0
- package/dist/tools/verify-plan-execution.js +295 -0
- package/dist/tools/web-fetch-injection-scanner.js +207 -0
- package/dist/tools/web-fetch.js +195 -10
- package/dist/tools/web-search.js +458 -0
- package/dist/tui/agent-progress-card.js +111 -0
- package/dist/tui/agent-tree.js +11 -1
- package/dist/tui/ask-modal.js +14 -14
- package/dist/tui/ask-user-question-chips.js +315 -0
- package/dist/tui/ask-user-question-prompt.js +203 -0
- package/dist/tui/compact-banner.js +81 -0
- package/dist/tui/conversation-pane.js +85 -11
- package/dist/tui/cost-table.js +111 -0
- package/dist/tui/device-flow.js +2 -2
- package/dist/tui/doctor-table.js +46 -0
- package/dist/tui/feedback-prompt.js +156 -0
- package/dist/tui/input-box.js +247 -32
- package/dist/tui/login-picker.js +3 -3
- package/dist/tui/markdown-render.js +6 -6
- package/dist/tui/multi-file-diff-approval.js +375 -0
- package/dist/tui/onboarding-wizard.js +240 -0
- package/dist/tui/permissions-picker.js +86 -0
- package/dist/tui/render.js +36 -1
- package/dist/tui/repl-render.js +176 -25
- package/dist/tui/repl-splash-art.js +16 -16
- package/dist/tui/repl-splash-mascot.js +48 -24
- package/dist/tui/repl-splash.js +22 -22
- package/dist/tui/repl.js +125 -45
- package/dist/tui/slash-palette.js +6 -6
- package/dist/tui/splash.js +2 -2
- package/dist/tui/status-bar.js +109 -31
- package/dist/tui/status-table.js +7 -0
- package/dist/tui/stickers-art.js +136 -0
- package/dist/tui/style-table.js +28 -0
- package/dist/tui/theme-table.js +29 -0
- package/dist/tui/thinking-spinner.js +123 -0
- package/dist/tui/tool-stream-pane.js +53 -4
- package/dist/tui/update-banner.js +27 -2
- package/dist/tui/vim-input.js +267 -0
- package/dist/tui/welcome-banner.js +107 -0
- package/dist/tui/welcome-data.js +293 -0
- package/dist/tui/workspace-context.js +2 -2
- package/package.json +31 -16
- package/test/scenarios/codegen-create-file.scenario.txt +13 -0
- package/test/scenarios/compact-force.scenario.txt +12 -0
- package/test/scenarios/identity.scenario.txt +12 -0
- package/test/scenarios/persona-handoff.scenario.txt +12 -0
- package/test/scenarios/walkback.scenario.txt +12 -0
- package/dist/core/engine/compaction-hook.js +0 -154
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* REPL slash command registry - Sprint
|
|
2
|
+
* REPL slash command registry - Sprint , expanded wave 2.
|
|
3
3
|
*
|
|
4
4
|
* The REPL input box surfaces a palette of slash commands the operator
|
|
5
5
|
* can run from inside a persistent session. The wave-2 expansion (CEO
|
|
6
|
-
*
|
|
7
|
-
* overlay matches the breadth
|
|
6
|
+
*) grows the surface from 6 to 20 commands so the `/help`
|
|
7
|
+
* overlay matches the breadth the upstream tool / peer CLI operators expect.
|
|
8
8
|
*
|
|
9
9
|
* The registry is pure: each `parseSlashCommand` call returns a
|
|
10
10
|
* `SlashCommandResult` describing what the REPL session should do next.
|
|
@@ -15,20 +15,21 @@
|
|
|
15
15
|
*
|
|
16
16
|
* Tiering (per CEO wave-2 spec):
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
18
|
+
* Tier 1 - wired against real state (3 + existing 6 = 9 wired):
|
|
19
|
+
* brief, agents, stop, help, quit, web, clear, version, jobs.
|
|
20
20
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
21
|
+
* Tier 2 - best-effort wiring against existing surfaces (3):
|
|
22
|
+
* diff, cost, status.
|
|
23
23
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* Tier 3 - deterministic stubs ("coming in αX.Y") (8):
|
|
25
|
+
* compact, resume, memory, config, privacy, budget, mcp, undo.
|
|
26
26
|
*
|
|
27
27
|
* Brand voice (brandbook §08): power words `brief / dispatch / stop /
|
|
28
28
|
* agents / quit / shipped`. Tagline `Brief it. It ships.` reserved for
|
|
29
29
|
* `/quit` confirmation and `/help` footer - never inline.
|
|
30
30
|
*/
|
|
31
31
|
import { listRoles } from '../agents/registry.js';
|
|
32
|
+
import { PERMISSION_MODES, parsePermissionMode, } from '../permissions/index.js';
|
|
32
33
|
/**
|
|
33
34
|
* Deterministic stub copy returned by the Tier 3 commands. Spec'd
|
|
34
35
|
* inline so the unit test can pin the exact text without poking at
|
|
@@ -38,45 +39,76 @@ import { listRoles } from '../agents/registry.js';
|
|
|
38
39
|
* silently appear here with empty placeholders.
|
|
39
40
|
*/
|
|
40
41
|
export const SLASH_STUB_MESSAGES = Object.freeze({
|
|
41
|
-
compact
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
// /compact graduated from stub. The session
|
|
43
|
+
// module now owns the summariser round-trip + boundary marker append
|
|
44
|
+
// via `dispatchCompact`. Keep the type record exhaustive so a future
|
|
45
|
+
// stub addition cannot silently overlap the wired set.
|
|
46
|
+
memory: 'Session memory editor lands in .',
|
|
47
|
+
config: 'Run `pugi config list` from a fresh shell for the full surface; in-REPL editor lands in .',
|
|
44
48
|
// alpha 6.13: /privacy graduated from stub; nothing reads this at
|
|
45
49
|
// runtime but the type record stays exhaustive.
|
|
46
50
|
privacy: '',
|
|
47
|
-
budget: 'Run `pugi budget` from a fresh shell; in-REPL summary lands in
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
budget: 'Run `pugi budget` from a fresh shell; in-REPL summary lands in .',
|
|
52
|
+
// β4 Sl7 : /mcp graduated from stub to a real handler
|
|
53
|
+
// that forwards to `runMcpCommand`. Stub message removed from the
|
|
54
|
+
// exhaustive record so the type narrows correctly.
|
|
55
|
+
//
|
|
56
|
+
// final : /undo graduated from stub to a real
|
|
57
|
+
// handler that forwards to `runUndoCommand` (Aider walk-back —
|
|
58
|
+
// single-step revert of the last mutating tool result, with
|
|
59
|
+
// mtime+hash external-modification gate). Stub message removed.
|
|
50
60
|
});
|
|
51
61
|
export const SLASH_COMMAND_HELP = Object.freeze([
|
|
52
62
|
// Workforce dispatch
|
|
53
63
|
{ name: 'brief', args: '<text>', gloss: 'Dispatch a brief to the workforce', group: 'Workforce dispatch' },
|
|
54
64
|
{ name: 'agents', args: '', gloss: 'List the on-watch agent roster', group: 'Workforce dispatch' },
|
|
55
|
-
{ name: 'delegate', args: '<slug> <brief>', gloss: 'Dispatch a brief to one Tier 1 specialist
|
|
65
|
+
{ name: 'delegate', args: '<slug> <brief>', gloss: 'Dispatch a brief to one Tier 1 specialist ', group: 'Workforce dispatch' },
|
|
56
66
|
{ name: 'stop', args: '<persona>', gloss: 'Stop one agent by persona slug', group: 'Workforce dispatch' },
|
|
57
|
-
{ name: 'jobs', args: '', gloss: 'List background jobs', group: 'Workforce dispatch' },
|
|
58
|
-
{ name: '
|
|
67
|
+
{ name: 'jobs', args: '[--watch]', gloss: 'List background jobs + agent-progress; --watch mounts the live Ink TUI', group: 'Workforce dispatch' },
|
|
68
|
+
{ name: 'cancel', args: '[<id> | all]', gloss: 'Halt active dispatch by id ', group: 'Workforce dispatch' },
|
|
69
|
+
{ name: 'ask', args: '<question>', gloss: 'Surface a yes/no modal locally ', group: 'Workforce dispatch' },
|
|
59
70
|
// Session
|
|
60
71
|
{ name: 'clear', args: '', gloss: 'Clear conversation pane', group: 'Session' },
|
|
61
72
|
{ name: 'resume', args: '', gloss: 'Pick a stored session to restore', group: 'Session' },
|
|
62
73
|
{ name: 'context', args: '', gloss: 'Show three-tier context summary (Tier 0 skeleton + Tier 1 working set)', group: 'Session' },
|
|
63
|
-
{ name: 'compact', args: '', gloss: '
|
|
64
|
-
{ name: '
|
|
74
|
+
{ name: 'compact', args: '[--force]', gloss: 'Summarise older turns into a boundary marker . --force bypasses the noop-empty guard', group: 'Session' },
|
|
75
|
+
{ name: 'rewind', args: '[N | --to <id>]', gloss: 'Roll the conversation back to a checkpoint ', group: 'Session' },
|
|
76
|
+
{ name: 'memory', args: '', gloss: 'Session memory editor ', group: 'Session', stub: true },
|
|
77
|
+
{ name: 'init', args: '', gloss: 'Scaffold .pugi/ in the current workspace (β1 Sl11)', group: 'Session' },
|
|
65
78
|
// Pugi tools
|
|
66
79
|
{ name: 'web', args: '<url>', gloss: 'Fetch a URL into context', group: 'Pugi tools' },
|
|
67
80
|
{ name: 'diff', args: '', gloss: 'Show pending diff', group: 'Pugi tools' },
|
|
68
|
-
{ name: 'cost', args: '', gloss: '
|
|
69
|
-
{ name: '
|
|
81
|
+
{ name: 'cost', args: '', gloss: 'Session token + USD totals + last 5 turn breakdown', group: 'Pugi tools' },
|
|
82
|
+
{ name: 'quota', args: '', gloss: 'Plan tier + monthly usage caps (sync / review / engine)', group: 'Pugi tools' },
|
|
83
|
+
{ name: 'status', args: '', gloss: 'Session snapshot — id · cwd · mode · tokens · dispatches · auth', group: 'Pugi tools' },
|
|
70
84
|
{ name: 'consensus', args: '[ref]', gloss: '3-model consensus review (codex · claude · deepseek)', group: 'Pugi tools' },
|
|
85
|
+
{ name: 'repo-map', args: '[refresh]', gloss: 'AST-light symbol summary of the workspace ', group: 'Pugi tools' },
|
|
86
|
+
{ name: 'codegraph-status', args: '[--install|--reindex|--offer]', gloss: 'Codegraph MCP — install state, index age, symbol count, refresh CTA ', group: 'Pugi tools' },
|
|
71
87
|
// Settings
|
|
72
88
|
{ name: 'config', args: '', gloss: 'Show config', group: 'Settings', stub: true },
|
|
73
89
|
{ name: 'privacy', args: '', gloss: 'Show privacy mode + contract', group: 'Settings' },
|
|
90
|
+
{ name: 'permissions', args: '[mode] [--persist]', gloss: 'Show or flip permission mode (default / acceptEdits / plan / auto / dontAsk / bypassPermissions) (also: /plan, Shift+Tab cycle)', group: 'Settings' },
|
|
91
|
+
{ name: 'plan', args: '[--back | --persist] [<prompt>]', gloss: 'Switch to plan mode (read-only). Same as /permissions plan, slicker UX.', group: 'Settings' },
|
|
92
|
+
{ name: 'model', args: '[<slug>]', gloss: 'Show or select the active model. Bare /model lists tier-gated options', group: 'Settings' },
|
|
74
93
|
{ name: 'budget', args: '', gloss: 'Show usage budget', group: 'Settings', stub: true },
|
|
75
|
-
{ name: 'mcp', args: '', gloss: '
|
|
76
|
-
{ name: '
|
|
94
|
+
{ name: 'mcp', args: '[sub]', gloss: 'MCP servers — list / trust / deny / install / serve / perms', group: 'Settings' },
|
|
95
|
+
{ name: 'style', args: '[name] [--persist|--reset|--list]', gloss: 'Output-style preset (default / terse / explanatory / russian-formal / casual)', group: 'Settings' },
|
|
96
|
+
{ name: 'theme', args: '[name] [--persist|--reset|--list]', gloss: 'TUI color palette (default / dark / light / colorblind)', group: 'Settings' },
|
|
97
|
+
{ name: 'onboarding', args: '[--reset|--non-interactive]', gloss: 'First-run wizard — auth / mode / style / MCP / telemetry ', group: 'Settings' },
|
|
98
|
+
{ name: 'vim', args: '[on|off|status]', gloss: 'Toggle vim-style modal editing in the input buffer ', group: 'Settings' },
|
|
99
|
+
{ name: 'undo', args: '', gloss: 'Revert the last successful write / edit / multi_edit (Aider walk-back, )', group: 'Settings' },
|
|
100
|
+
{ name: 'redo', args: '', gloss: 'Reapply the most recent /undo (LIFO stack, cleanup)', group: 'Settings' },
|
|
77
101
|
// Meta
|
|
78
102
|
{ name: 'help', args: '', gloss: 'Show this help overlay', group: 'Meta' },
|
|
79
103
|
{ name: 'version', args: '', gloss: 'Show CLI version', group: 'Meta' },
|
|
104
|
+
{ name: 'doctor', args: '', gloss: 'Environment health report (auth · API · Node · disk · MCP · …)', group: 'Meta' },
|
|
105
|
+
{ name: 'prd-check', args: '<prd-path | --all | --session> [--json]', gloss: 'Verify PRD against code (default) or session work (--session, final)', group: 'Meta' },
|
|
106
|
+
{ name: 'chain', args: '<new|status|next|show|export|list> [...args]', gloss: 'Artifact chain — PRD → ADR → mindmap → ER → sequence → tests → code ', group: 'Meta' },
|
|
107
|
+
{ name: 'stickers', args: '', gloss: 'show Pugi brand stickers (gimmick)', group: 'Meta' },
|
|
108
|
+
{ name: 'feedback', args: '', gloss: 'file a bug / feature / general comment without leaving the REPL', group: 'Meta' },
|
|
109
|
+
{ name: 'share', args: '[--gist|--pugi] [--redact] [--preview]', gloss: 'Export session transcript to gist / pugi.io ', group: 'Meta' },
|
|
110
|
+
{ name: 'release-notes', args: '[--reset]', gloss: 'Show changelog diff since last upgrade ', group: 'Meta' },
|
|
111
|
+
{ name: 'update', args: '[--check|--apply [--yes]] [--channel <name>]', gloss: 'Check for / apply CLI update on stable / beta / canary ', group: 'Meta' },
|
|
80
112
|
{ name: 'quit', args: '', gloss: 'Exit the REPL', group: 'Meta' },
|
|
81
113
|
]);
|
|
82
114
|
/**
|
|
@@ -93,20 +125,88 @@ export const SLASH_COMMAND_GROUPS = Object.freeze([
|
|
|
93
125
|
/**
|
|
94
126
|
* Parse one line of input from the REPL. The contract:
|
|
95
127
|
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
128
|
+
* - Empty / whitespace-only input returns `noop` with the original
|
|
129
|
+
* text so the REPL can ignore it without printing anything.
|
|
130
|
+
* - Input that does not start with `/` is treated as an implicit
|
|
131
|
+
* `/brief <text>` - the most-common operator action.
|
|
132
|
+
* - `/<name> [args]` resolves the name against the registry; unknown
|
|
133
|
+
* names return `error` so the REPL can render a one-line tip
|
|
134
|
+
* instead of silently dropping the input.
|
|
135
|
+
* - Tier 3 stubs return `{ kind: 'stub', name, message }` so the REPL
|
|
136
|
+
* can render the deterministic "coming in αX.Y" copy uniformly.
|
|
105
137
|
*
|
|
106
138
|
* The function never throws. Bad input maps to a structured result the
|
|
107
139
|
* REPL can render - the alternative (throwing from a keystroke handler)
|
|
108
140
|
* would unmount Ink mid-frame.
|
|
109
141
|
*/
|
|
142
|
+
/**
|
|
143
|
+
* Pugi backlog : parse the artifact-store subcommands
|
|
144
|
+
* of `/plan`. Kept module-local because the legacy mode-toggle parser
|
|
145
|
+
* already owns the `case 'plan':` branch — this helper is the
|
|
146
|
+
* dispatch tail when the first arg is `show / list / diff / prune`.
|
|
147
|
+
*
|
|
148
|
+
* Argument grammar:
|
|
149
|
+
* /plan show <planId>
|
|
150
|
+
* /plan list [<taskId>]
|
|
151
|
+
* /plan diff <planId> [<otherId>]
|
|
152
|
+
* /plan prune [<maxAgeDays>]
|
|
153
|
+
*
|
|
154
|
+
* Validation:
|
|
155
|
+
* - `planId` is required for show + diff; surfaced as a structured
|
|
156
|
+
* error verdict when missing so the REPL renders one line of
|
|
157
|
+
* guidance instead of falling through to the mode-toggle path.
|
|
158
|
+
* - `maxAgeDays` is parsed as a positive integer; missing leaves the
|
|
159
|
+
* core module's default in place. Negative / NaN inputs become
|
|
160
|
+
* errors so the operator does not silently wipe their plan store.
|
|
161
|
+
*/
|
|
162
|
+
function parsePlanArtifactSubcommand(op, rest) {
|
|
163
|
+
if (op === 'show') {
|
|
164
|
+
const planId = rest[0];
|
|
165
|
+
if (!planId) {
|
|
166
|
+
return {
|
|
167
|
+
kind: 'error',
|
|
168
|
+
message: '/plan show <plan-id> — plan-id is required.',
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
return { kind: 'plan-artifact', sub: { op: 'show', planId } };
|
|
172
|
+
}
|
|
173
|
+
if (op === 'list') {
|
|
174
|
+
const taskId = rest[0];
|
|
175
|
+
return {
|
|
176
|
+
kind: 'plan-artifact',
|
|
177
|
+
sub: taskId ? { op: 'list', taskId } : { op: 'list' },
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
if (op === 'diff') {
|
|
181
|
+
const planId = rest[0];
|
|
182
|
+
if (!planId) {
|
|
183
|
+
return {
|
|
184
|
+
kind: 'error',
|
|
185
|
+
message: '/plan diff <plan-id> [<other-id>] — plan-id is required.',
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
const otherId = rest[1];
|
|
189
|
+
return {
|
|
190
|
+
kind: 'plan-artifact',
|
|
191
|
+
sub: otherId
|
|
192
|
+
? { op: 'diff', planId, otherId }
|
|
193
|
+
: { op: 'diff', planId },
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
// prune
|
|
197
|
+
const raw = rest[0];
|
|
198
|
+
if (raw === undefined) {
|
|
199
|
+
return { kind: 'plan-artifact', sub: { op: 'prune' } };
|
|
200
|
+
}
|
|
201
|
+
const parsed = Number(raw);
|
|
202
|
+
if (!Number.isFinite(parsed) || parsed <= 0 || !Number.isInteger(parsed)) {
|
|
203
|
+
return {
|
|
204
|
+
kind: 'error',
|
|
205
|
+
message: `/plan prune [<days>] — expected positive integer, got '${raw}'.`,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
return { kind: 'plan-artifact', sub: { op: 'prune', maxAgeDays: parsed } };
|
|
209
|
+
}
|
|
110
210
|
export function parseSlashCommand(input) {
|
|
111
211
|
const trimmed = input.trim();
|
|
112
212
|
if (trimmed.length === 0) {
|
|
@@ -203,7 +303,48 @@ export function parseSlashCommand(input) {
|
|
|
203
303
|
return { kind: 'version' };
|
|
204
304
|
}
|
|
205
305
|
case 'jobs': {
|
|
206
|
-
|
|
306
|
+
// cleanup : tokenise the tail so the slash
|
|
307
|
+
// can route `--watch` к the live Ink TUI (same renderer as
|
|
308
|
+
// `pugi jobs --watch`). Unknown tokens fall through silently —
|
|
309
|
+
// the slash surface is intentionally minimal vs. the shell
|
|
310
|
+
// command (which supports list/status/tail/kill subcommands
|
|
311
|
+
// through `runJobsCommand`).
|
|
312
|
+
const tokens = tail.length === 0 ? [] : tail.split(/\s+/).filter((s) => s.length > 0);
|
|
313
|
+
const watch = tokens.includes('--watch') || tokens.includes('-w') || tokens[0] === 'watch';
|
|
314
|
+
return { kind: 'jobs', watch };
|
|
315
|
+
}
|
|
316
|
+
case 'cancel':
|
|
317
|
+
case 'halt': {
|
|
318
|
+
// small-CC-parity batch :
|
|
319
|
+
//
|
|
320
|
+
// /cancel -> list active dispatches
|
|
321
|
+
// /cancel all -> halt every running dispatch
|
|
322
|
+
// /cancel <id> -> halt one (id may be a prefix; runner
|
|
323
|
+
// does startsWith lookup)
|
|
324
|
+
//
|
|
325
|
+
// The `halt` alias matches operator muscle memory from systemd /
|
|
326
|
+
// brand voice (`stop` is already taken by /stop <persona>; cancel
|
|
327
|
+
// is dispatch-id-keyed, stop is persona-keyed). Unknown extra
|
|
328
|
+
// tokens are tolerated — the runner reads only the first.
|
|
329
|
+
const trimmedTail = tail.trim();
|
|
330
|
+
if (trimmedTail.length === 0) {
|
|
331
|
+
return { kind: 'cancel', mode: 'list', dispatchId: '' };
|
|
332
|
+
}
|
|
333
|
+
const firstToken = trimmedTail.split(/\s+/)[0].toLowerCase();
|
|
334
|
+
if (firstToken === 'all' || firstToken === '*') {
|
|
335
|
+
return { kind: 'cancel', mode: 'all', dispatchId: 'all' };
|
|
336
|
+
}
|
|
337
|
+
// Defensive: dispatch ids are filename-safe per the
|
|
338
|
+
// `validateAgentProgress` agentId regex (`[a-zA-Z0-9_-]+`).
|
|
339
|
+
// Reject anything outside that range with a usage tip so the
|
|
340
|
+
// operator sees the typo before the round-trip.
|
|
341
|
+
if (!/^[A-Za-z0-9_-]+$/.test(firstToken)) {
|
|
342
|
+
return {
|
|
343
|
+
kind: 'error',
|
|
344
|
+
message: `/cancel: invalid dispatch id '${firstToken}'. Use letters / digits / '-' / '_' only.`,
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
return { kind: 'cancel', mode: 'one', dispatchId: firstToken };
|
|
207
348
|
}
|
|
208
349
|
case 'ask': {
|
|
209
350
|
if (tail.length === 0) {
|
|
@@ -214,9 +355,19 @@ export function parseSlashCommand(input) {
|
|
|
214
355
|
case 'diff': {
|
|
215
356
|
return { kind: 'diff' };
|
|
216
357
|
}
|
|
217
|
-
case 'cost':
|
|
358
|
+
case 'cost':
|
|
359
|
+
case 'usage': {
|
|
360
|
+
// L19 : `/usage` is an alias of `/cost` per the cost-
|
|
361
|
+
// command spec. The previous mapping routed `/usage` to the
|
|
362
|
+
// network-backed `/quota` surface, but operators trained on Claude
|
|
363
|
+
// Code expect `/usage` to surface the per-model token breakdown
|
|
364
|
+
// (same shape as `/cost`). `/quota` remains the canonical name
|
|
365
|
+
// for the tier + monthly-cap fetch.
|
|
218
366
|
return { kind: 'cost' };
|
|
219
367
|
}
|
|
368
|
+
case 'quota': {
|
|
369
|
+
return { kind: 'quota' };
|
|
370
|
+
}
|
|
220
371
|
case 'status': {
|
|
221
372
|
return { kind: 'status' };
|
|
222
373
|
}
|
|
@@ -228,14 +379,14 @@ export function parseSlashCommand(input) {
|
|
|
228
379
|
return { kind: 'consensus', ref: tail };
|
|
229
380
|
}
|
|
230
381
|
case 'resume': {
|
|
231
|
-
//
|
|
382
|
+
// : wired against the local SessionStore. The REPL session
|
|
232
383
|
// owns the picker UI (Ink select over the 10 most recent rows)
|
|
233
384
|
// so the slash-command layer stays UI-agnostic.
|
|
234
385
|
return { kind: 'resume' };
|
|
235
386
|
}
|
|
236
387
|
case 'context':
|
|
237
388
|
case 'ctx': {
|
|
238
|
-
//
|
|
389
|
+
// : surface Tier 0 + Tier 1 status. The session module
|
|
239
390
|
// renders the summary as system lines so the operator can see
|
|
240
391
|
// skeleton size + working-set utilisation at a glance.
|
|
241
392
|
return { kind: 'context' };
|
|
@@ -248,12 +399,321 @@ export function parseSlashCommand(input) {
|
|
|
248
399
|
// device flow + audit identity are wired correctly).
|
|
249
400
|
return { kind: 'privacy' };
|
|
250
401
|
}
|
|
251
|
-
case '
|
|
402
|
+
case 'permissions':
|
|
403
|
+
case 'perms': {
|
|
404
|
+
// : `/permissions [mode] [--persist] [--confirm]`.
|
|
405
|
+
//
|
|
406
|
+
// Argument grammar (single line, no quoting):
|
|
407
|
+
// /permissions -> show + table
|
|
408
|
+
// /permissions default|acceptEdits|plan|auto|dontAsk -> flip mode
|
|
409
|
+
// /permissions bypassPermissions --confirm -> flip to
|
|
410
|
+
// bypassPermissions (refused
|
|
411
|
+
// без --confirm — safety)
|
|
412
|
+
// /permissions <mode> --persist -> also write to ~/.pugi/config.json
|
|
413
|
+
//
|
|
414
|
+
// aliases (`ask`, `allow`, `bypass`) are accepted и mapped to
|
|
415
|
+
// their canonical names via `parsePermissionMode`.
|
|
416
|
+
const tokens = tail.length === 0 ? [] : tail.split(/\s+/).filter((s) => s.length > 0);
|
|
417
|
+
if (tokens.length === 0) {
|
|
418
|
+
return { kind: 'permissions', persist: false, confirmBypass: false };
|
|
419
|
+
}
|
|
420
|
+
const headRaw = tokens[0] ?? '';
|
|
421
|
+
const mode = parsePermissionMode(headRaw);
|
|
422
|
+
if (!mode) {
|
|
423
|
+
const modeList = [...PERMISSION_MODES].join('|');
|
|
424
|
+
return {
|
|
425
|
+
kind: 'error',
|
|
426
|
+
message: `Usage: /permissions [${modeList}] [--persist] [--confirm]; unknown mode '${headRaw}'`,
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
const flags = tokens.slice(1);
|
|
430
|
+
let persist = false;
|
|
431
|
+
let confirmBypass = false;
|
|
432
|
+
for (const flag of flags) {
|
|
433
|
+
if (flag === '--persist') {
|
|
434
|
+
persist = true;
|
|
435
|
+
}
|
|
436
|
+
else if (flag === '--confirm') {
|
|
437
|
+
confirmBypass = true;
|
|
438
|
+
}
|
|
439
|
+
else {
|
|
440
|
+
return {
|
|
441
|
+
kind: 'error',
|
|
442
|
+
message: `/permissions: unknown flag '${flag}' (allowed: --persist, --confirm)`,
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return { kind: 'permissions', mode, persist, confirmBypass };
|
|
447
|
+
}
|
|
448
|
+
case 'init': {
|
|
449
|
+
// β1 Sl11: surface the init flow inside the REPL. Tail args
|
|
450
|
+
// are ignored — the init handler is parameterless today; `pugi
|
|
451
|
+
// init --no-defaults` is the CLI surface for skipping bundled
|
|
452
|
+
// skills.
|
|
453
|
+
return { kind: 'init' };
|
|
454
|
+
}
|
|
455
|
+
case 'plan': {
|
|
456
|
+
// `/plan [--back | --persist] [<prompt>]`.
|
|
457
|
+
//
|
|
458
|
+
// Argument grammar (single line, no quoting):
|
|
459
|
+
// /plan -> enter plan mode + banner
|
|
460
|
+
// /plan --back -> restore previous mode
|
|
461
|
+
// /plan --persist -> enter + write global config
|
|
462
|
+
// /plan <prompt...> -> enter + run one-shot engine
|
|
463
|
+
// /plan --auto-back <prompt...> -> enter + run + restore mode
|
|
464
|
+
//
|
|
465
|
+
// The parser pulls the flags off the head of the tail; whatever
|
|
466
|
+
// remains is the prompt. `--back` + a non-empty prompt and
|
|
467
|
+
// `--back` + `--auto-back` are both refused as `error` because
|
|
468
|
+
// they conflict at the verb level.
|
|
469
|
+
//
|
|
470
|
+
// Pugi backlog : when the FIRST token of the
|
|
471
|
+
// tail is one of the artifact subcommands (`show / list / diff /
|
|
472
|
+
// prune`), the parser hands off to the plan-as-FILE surface
|
|
473
|
+
// instead of the mode-toggle. This keeps both feature sets under
|
|
474
|
+
// one `/plan` namespace without overloading the verb table.
|
|
475
|
+
const tokens = tail.length === 0 ? [] : tail.split(/\s+/).filter((s) => s.length > 0);
|
|
476
|
+
const head = tokens[0];
|
|
477
|
+
if (head === 'show' || head === 'list' || head === 'diff' || head === 'prune') {
|
|
478
|
+
return parsePlanArtifactSubcommand(head, tokens.slice(1));
|
|
479
|
+
}
|
|
480
|
+
let back = false;
|
|
481
|
+
let persist = false;
|
|
482
|
+
let autoBack = false;
|
|
483
|
+
const promptTokens = [];
|
|
484
|
+
for (const token of tokens) {
|
|
485
|
+
if (token === '--back') {
|
|
486
|
+
back = true;
|
|
487
|
+
}
|
|
488
|
+
else if (token === '--persist') {
|
|
489
|
+
persist = true;
|
|
490
|
+
}
|
|
491
|
+
else if (token === '--auto-back') {
|
|
492
|
+
autoBack = true;
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
promptTokens.push(token);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
const prompt = promptTokens.join(' ');
|
|
499
|
+
if (back && prompt.length > 0) {
|
|
500
|
+
return {
|
|
501
|
+
kind: 'error',
|
|
502
|
+
message: '/plan --back does not accept a prompt; revert first, then dispatch.',
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
if (back && autoBack) {
|
|
506
|
+
return {
|
|
507
|
+
kind: 'error',
|
|
508
|
+
message: '/plan --back and --auto-back cannot be combined.',
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
return { kind: 'plan', back, persist, autoBack, prompt };
|
|
512
|
+
}
|
|
513
|
+
case 'model': {
|
|
514
|
+
// BT 8 (the upstream tool parity): `/model [<slug>]`. Bare form
|
|
515
|
+
// prints the tier-gated model menu + current selection; with a
|
|
516
|
+
// slug it flips workspace selection. Slug grammar (loose): alnum
|
|
517
|
+
// + dash + dot + slash. Anything outside that range becomes an
|
|
518
|
+
// error verdict so the operator sees a clear message instead of a
|
|
519
|
+
// silent no-op. Whitespace inside the tail = multiple tokens = we
|
|
520
|
+
// take the first; the help gloss documents single-slug usage.
|
|
521
|
+
const trimmedTail = tail.trim();
|
|
522
|
+
if (trimmedTail.length === 0) {
|
|
523
|
+
return { kind: 'model', slug: undefined };
|
|
524
|
+
}
|
|
525
|
+
const firstToken = trimmedTail.split(/\s+/)[0] ?? '';
|
|
526
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._\-\/]{0,63}$/.test(firstToken)) {
|
|
527
|
+
return {
|
|
528
|
+
kind: 'error',
|
|
529
|
+
message: `/model: invalid slug '${firstToken}'. Use letters / digits / '-' / '.' / '/' only.`,
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
return { kind: 'model', slug: firstToken };
|
|
533
|
+
}
|
|
534
|
+
case 'mcp': {
|
|
535
|
+
// β4 Sl7: tokenize the tail. Empty tail -> `list` (matches CLI).
|
|
536
|
+
// Quoting / shell-escapes are NOT supported — the slash surface is
|
|
537
|
+
// intentionally simple; complex installs (env vars, multi-word
|
|
538
|
+
// args) go through `pugi mcp install` from a fresh shell.
|
|
539
|
+
const tokens = tail.length === 0 ? [] : tail.split(/\s+/).filter((s) => s.length > 0);
|
|
540
|
+
return { kind: 'mcp', args: tokens };
|
|
541
|
+
}
|
|
542
|
+
case 'style':
|
|
543
|
+
case 'output-style': {
|
|
544
|
+
// forward the tokenized tail unchanged so
|
|
545
|
+
// the slash + top-level CLI surfaces share one parser inside
|
|
546
|
+
// `runStyleCommand`. Quoting / multi-word args are not used (the
|
|
547
|
+
// preset slugs are single tokens by contract).
|
|
548
|
+
const tokens = tail.length === 0 ? [] : tail.split(/\s+/).filter((s) => s.length > 0);
|
|
549
|
+
return { kind: 'style', args: tokens };
|
|
550
|
+
}
|
|
551
|
+
case 'theme':
|
|
552
|
+
case 'palette':
|
|
553
|
+
case 'colors': {
|
|
554
|
+
// forward the tokenized tail unchanged so
|
|
555
|
+
// the slash + top-level `pugi theme` surfaces share one parser
|
|
556
|
+
// inside `runThemeCommand`. Aliases `/palette` and `/colors`
|
|
557
|
+
// exist because the leak-landscape audit found operators reach
|
|
558
|
+
// for either word interchangeably — same surface, same handler.
|
|
559
|
+
const tokens = tail.length === 0 ? [] : tail.split(/\s+/).filter((s) => s.length > 0);
|
|
560
|
+
return { kind: 'theme', args: tokens };
|
|
561
|
+
}
|
|
562
|
+
case 'onboarding':
|
|
563
|
+
case 'onboard':
|
|
564
|
+
case 'setup': {
|
|
565
|
+
// forward the tokenized tail unchanged.
|
|
566
|
+
// The slash always routes through the non-interactive snapshot
|
|
567
|
+
// path (the REPL already owns the Ink tree); the runner picks
|
|
568
|
+
// it up from `ctx.interactive = false` in the session
|
|
569
|
+
// dispatcher.
|
|
570
|
+
const tokens = tail.length === 0 ? [] : tail.split(/\s+/).filter((s) => s.length > 0);
|
|
571
|
+
return { kind: 'onboarding', args: tokens };
|
|
572
|
+
}
|
|
573
|
+
case 'vim': {
|
|
574
|
+
// forward the tokenized tail unchanged so
|
|
575
|
+
// the slash + top-level CLI surfaces share one parser inside
|
|
576
|
+
// `runVimCommand`. Subcommands are single tokens (on / off /
|
|
577
|
+
// status); a bare `/vim` toggles.
|
|
578
|
+
const tokens = tail.length === 0 ? [] : tail.split(/\s+/).filter((s) => s.length > 0);
|
|
579
|
+
return { kind: 'vim', args: tokens };
|
|
580
|
+
}
|
|
581
|
+
case 'doctor':
|
|
582
|
+
case 'health': {
|
|
583
|
+
// L17 : run the probe sweep inline. Tail is ignored —
|
|
584
|
+
// the doctor command has no operator-facing arguments (every
|
|
585
|
+
// probe runs unconditionally; per-probe disable lives on the CLI
|
|
586
|
+
// shell surface, not the slash one).
|
|
587
|
+
return { kind: 'doctor' };
|
|
588
|
+
}
|
|
589
|
+
case 'prd-check':
|
|
590
|
+
case 'prdcheck': {
|
|
591
|
+
// : tokenise the tail and forward verbatim
|
|
592
|
+
// so the slash + shell surfaces share one `parsePrdCheckArgs`.
|
|
593
|
+
// Supports `<prd-path>`, `--all`, and `--json`.
|
|
594
|
+
const tokens = tail.length === 0 ? [] : tail.split(/\s+/).filter((s) => s.length > 0);
|
|
595
|
+
return { kind: 'prd-check', args: tokens };
|
|
596
|
+
}
|
|
597
|
+
case 'chain': {
|
|
598
|
+
// : forward the tokenized argv to
|
|
599
|
+
// `runChainCommand` via the session module. Subcommands are
|
|
600
|
+
// single tokens (new / status / next / show / export / list);
|
|
601
|
+
// the `new` subcommand accepts the intent as the joined tail so
|
|
602
|
+
// operators can write `/chain new add auth flow` без quoting.
|
|
603
|
+
const tokens = tail.length === 0 ? [] : tail.split(/\s+/).filter((s) => s.length > 0);
|
|
604
|
+
return { kind: 'chain', args: tokens };
|
|
605
|
+
}
|
|
606
|
+
case 'codegraph-status':
|
|
607
|
+
case 'codegraph': {
|
|
608
|
+
// BT 9 Phase 2 : forward the tokenized argv
|
|
609
|
+
// to `runCodegraphStatusCommand`. Flags handled by the runner:
|
|
610
|
+
// --install — merge codegraph into .pugi/mcp.json (accept)
|
|
611
|
+
// --reindex — stamp lastIndexedAt + hint runtime to refresh
|
|
612
|
+
// --offer — surface the install prompt even after a decline
|
|
613
|
+
// `/codegraph` is the short alias; same handler.
|
|
614
|
+
const tokens = tail.length === 0 ? [] : tail.split(/\s+/).filter((s) => s.length > 0);
|
|
615
|
+
return { kind: 'codegraph-status', args: tokens };
|
|
616
|
+
}
|
|
617
|
+
case 'compact': {
|
|
618
|
+
// graduated from stub. The session module
|
|
619
|
+
// owns the summariser round-trip. BT 8: `--force` overrides
|
|
620
|
+
// the noop-empty guard. Unknown flags fall through silently per
|
|
621
|
+
// the existing tail-tolerance behaviour (operators wanting a
|
|
622
|
+
// per-session compact run `pugi compact --session <id>` from a
|
|
623
|
+
// fresh shell).
|
|
624
|
+
const tokens = tail.length === 0 ? [] : tail.split(/\s+/).filter((s) => s.length > 0);
|
|
625
|
+
const force = tokens.some((t) => t === '--force' || t === '-f');
|
|
626
|
+
return { kind: 'compact', force };
|
|
627
|
+
}
|
|
628
|
+
case 'rewind': {
|
|
629
|
+
// `/rewind [N | --to <id>]`. Tokenize the
|
|
630
|
+
// tail unchanged so `runRewindCommand` (in `runtime/commands/
|
|
631
|
+
// rewind.ts`) handles every mode (picker / turns / to-event)
|
|
632
|
+
// through one parser. The slash + top-level CLI surfaces stay
|
|
633
|
+
// single-sourced — same separation as `/compact`.
|
|
634
|
+
const tokens = tail.length === 0 ? [] : tail.split(/\s+/).filter((s) => s.length > 0);
|
|
635
|
+
return { kind: 'rewind', args: tokens };
|
|
636
|
+
}
|
|
637
|
+
case 'stickers': {
|
|
638
|
+
// brand-personality gimmick. Tail args
|
|
639
|
+
// are ignored — the surface is intentionally parameterless. The
|
|
640
|
+
// session module delegates to the shared `runStickersCommand`
|
|
641
|
+
// so the slash + top-level paths stay single-sourced.
|
|
642
|
+
return { kind: 'stickers' };
|
|
643
|
+
}
|
|
644
|
+
case 'feedback': {
|
|
645
|
+
// in-CLI feedback collector. The wizard
|
|
646
|
+
// collects category/rating/comment/context/confirm interactively
|
|
647
|
+
// so the slash surface is parameterless. Tail args are reserved
|
|
648
|
+
// for a future `--message=...` quick-path; today they are
|
|
649
|
+
// accepted but ignored so the operator-level UX matches
|
|
650
|
+
// the upstream tool's `/feedback`.
|
|
651
|
+
return { kind: 'feedback' };
|
|
652
|
+
}
|
|
653
|
+
case 'share': {
|
|
654
|
+
// forward the tokenized arg list verbatim
|
|
655
|
+
// so the session module (which owns the network + readline
|
|
656
|
+
// affordances) can hand them to runShareCommand. Defaults: no
|
|
657
|
+
// tokens means "auto-pick target + prompt for confirmation".
|
|
658
|
+
const tokens = tail.length === 0 ? [] : tail.split(/\s+/).filter((s) => s.length > 0);
|
|
659
|
+
return { kind: 'share', args: tokens };
|
|
660
|
+
}
|
|
661
|
+
case 'repo-map':
|
|
662
|
+
case 'repomap': {
|
|
663
|
+
// build + show the AST-light symbol
|
|
664
|
+
// summary. Accepts `refresh` as a positional или `--refresh`
|
|
665
|
+
// flag so muscle memory from both shells lands the same way.
|
|
666
|
+
const tokens = tail.length === 0 ? [] : tail.split(/\s+/).filter((s) => s.length > 0);
|
|
667
|
+
const refresh = tokens.includes('--refresh') || tokens.includes('refresh') || tokens.includes('-r');
|
|
668
|
+
return { kind: 'repo-map', refresh };
|
|
669
|
+
}
|
|
670
|
+
case 'release-notes':
|
|
671
|
+
case 'releasenotes':
|
|
672
|
+
case 'changelog': {
|
|
673
|
+
// changelog diff between last-seen +
|
|
674
|
+
// installed CLI version. Tail args are tokenized so `--reset`
|
|
675
|
+
// can flip the marker-clear bit; no other flags are honoured —
|
|
676
|
+
// the surface mirrors the CLI top-level's intentional minimalism.
|
|
677
|
+
// `changelog` alias matches operator muscle memory from npm /
|
|
678
|
+
// cargo / brew, all of which ship `changelog` subcommands.
|
|
679
|
+
const tokens = tail.length === 0 ? [] : tail.split(/\s+/).filter((s) => s.length > 0);
|
|
680
|
+
const reset = tokens.includes('--reset') || tokens.includes('-r');
|
|
681
|
+
return { kind: 'release-notes', reset };
|
|
682
|
+
}
|
|
683
|
+
case 'update': {
|
|
684
|
+
// forward the tokenized argv to the
|
|
685
|
+
// session module which delegates to `runUpdateCommand`. The
|
|
686
|
+
// dispatcher owns argv validation (unknown channel / flag) so
|
|
687
|
+
// the slash parser stays as thin as the rest of the surface.
|
|
688
|
+
// The slash form does NOT support `--apply` because spawning
|
|
689
|
+
// `npm install -g` from inside a running REPL session would
|
|
690
|
+
// corrupt the operator's running binary — the dispatcher treats
|
|
691
|
+
// `--apply` from a slash as a non-interactive offer (probe +
|
|
692
|
+
// install command, no shell-out). Top-level `pugi update --apply`
|
|
693
|
+
// remains the recommended path for the actual install.
|
|
694
|
+
const tokens = tail.length === 0 ? [] : tail.split(/\s+/).filter((s) => s.length > 0);
|
|
695
|
+
return { kind: 'update', args: tokens };
|
|
696
|
+
}
|
|
697
|
+
case 'undo': {
|
|
698
|
+
// final : graduated from stub. Tail args are
|
|
699
|
+
// ignored — `runUndoCommand` is parameterless (single-step revert
|
|
700
|
+
// of the most recent successful mutating tool result). Multiple
|
|
701
|
+
// undos = stack of single-step undos. `/redo` is the counterpart
|
|
702
|
+
// — operators ping-pong через undo/redo on the
|
|
703
|
+
// event-log stack without re-running the underlying tool.
|
|
704
|
+
return { kind: 'undo' };
|
|
705
|
+
}
|
|
706
|
+
case 'redo': {
|
|
707
|
+
// cleanup : counterpart к /undo. Tail args
|
|
708
|
+
// are ignored — `runRedoCommand` is parameterless. Each /redo
|
|
709
|
+
// pops one entry from the LIFO undo stack (the runner tracks
|
|
710
|
+
// which undos have already been consumed by previous redos so
|
|
711
|
+
// double-/redo is a noop, not a double-write).
|
|
712
|
+
return { kind: 'redo' };
|
|
713
|
+
}
|
|
252
714
|
case 'memory':
|
|
253
715
|
case 'config':
|
|
254
|
-
case 'budget':
|
|
255
|
-
case 'mcp':
|
|
256
|
-
case 'undo': {
|
|
716
|
+
case 'budget': {
|
|
257
717
|
const stubName = name;
|
|
258
718
|
return {
|
|
259
719
|
kind: 'stub',
|