@proflandrigan/shards 1.1.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.
- package/README.md +475 -0
- package/package.json +37 -0
- package/src/agents/academic.md +276 -0
- package/src/agents/ai-engineer.md +377 -0
- package/src/agents/analytics-engineer.md +364 -0
- package/src/agents/applied-ml-scientist.md +410 -0
- package/src/agents/backend-engineer.md +255 -0
- package/src/agents/bi-engineer.md +333 -0
- package/src/agents/data-analyst.md +343 -0
- package/src/agents/data-engineer.md +260 -0
- package/src/agents/data-modeller.md +386 -0
- package/src/agents/data-scientist.md +366 -0
- package/src/agents/deep-learning-engineer.md +389 -0
- package/src/agents/ml-engineer.md +424 -0
- package/src/agents/mlops-engineer.md +339 -0
- package/src/agents/researcher.md +187 -0
- package/src/agents/specific_instructions/academic/critical_review.md +263 -0
- package/src/agents/specific_instructions/academic/report.md +113 -0
- package/src/agents/specific_instructions/ai_engineer/advise.md +162 -0
- package/src/agents/specific_instructions/ai_engineer/bi_engineer_handoff.md +86 -0
- package/src/agents/specific_instructions/ai_engineer/experiment.md +471 -0
- package/src/agents/specific_instructions/ai_engineer/experiment_ui_mode.md +44 -0
- package/src/agents/specific_instructions/ai_engineer/phases/index.md +45 -0
- package/src/agents/specific_instructions/ai_engineer/phases/phase-1.md +55 -0
- package/src/agents/specific_instructions/ai_engineer/phases/phase-2.md +86 -0
- package/src/agents/specific_instructions/ai_engineer/phases/phase-3.md +96 -0
- package/src/agents/specific_instructions/ai_engineer/phases/phase-4.md +138 -0
- package/src/agents/specific_instructions/ai_engineer/phases/phase-5.md +157 -0
- package/src/agents/specific_instructions/ai_engineer/phases/phase-6.md +196 -0
- package/src/agents/specific_instructions/ai_engineer/phases/phase-7.md +313 -0
- package/src/agents/specific_instructions/ai_engineer/phases.md +1011 -0
- package/src/agents/specific_instructions/ai_engineer/prompt_lab.md +161 -0
- package/src/agents/specific_instructions/ai_engineer/prompt_lab_ui_mode.md +28 -0
- package/src/agents/specific_instructions/ai_engineer/research.md +393 -0
- package/src/agents/specific_instructions/ai_engineer/research_ui_mode.md +66 -0
- package/src/agents/specific_instructions/ai_engineer/review.md +159 -0
- package/src/agents/specific_instructions/ai_engineer/validation_checklist.md +182 -0
- package/src/agents/specific_instructions/analytics_engineer/advise.md +155 -0
- package/src/agents/specific_instructions/analytics_engineer/bi_engineer_handoff.md +91 -0
- package/src/agents/specific_instructions/analytics_engineer/data_analyst_handoff.md +84 -0
- package/src/agents/specific_instructions/analytics_engineer/deep_phases.md +818 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_deep/index.md +24 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-1.md +77 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-2.md +106 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-3.md +93 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-4.md +79 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-5.md +61 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-6.md +45 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-7.md +235 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_deep/phase-8.md +221 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_quick/index.md +19 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_quick/phase-1.md +47 -0
- package/src/agents/specific_instructions/analytics_engineer/phases_quick/phase-2.md +78 -0
- package/src/agents/specific_instructions/analytics_engineer/quick_phases.md +112 -0
- package/src/agents/specific_instructions/analytics_engineer/review.md +167 -0
- package/src/agents/specific_instructions/analytics_engineer/service_mode.md +369 -0
- package/src/agents/specific_instructions/analytics_engineer/ui_mode.md +45 -0
- package/src/agents/specific_instructions/analytics_engineer/update.md +162 -0
- package/src/agents/specific_instructions/analytics_engineer/validation_checklist.md +121 -0
- package/src/agents/specific_instructions/applied_ml_scientist/advise.md +143 -0
- package/src/agents/specific_instructions/applied_ml_scientist/phases/index.md +21 -0
- package/src/agents/specific_instructions/applied_ml_scientist/phases/phase-1.md +51 -0
- package/src/agents/specific_instructions/applied_ml_scientist/phases/phase-2.md +66 -0
- package/src/agents/specific_instructions/applied_ml_scientist/phases/phase-3.md +113 -0
- package/src/agents/specific_instructions/applied_ml_scientist/phases/phase-4.md +104 -0
- package/src/agents/specific_instructions/applied_ml_scientist/phases/phase-5.md +156 -0
- package/src/agents/specific_instructions/applied_ml_scientist/phases.md +428 -0
- package/src/agents/specific_instructions/applied_ml_scientist/research.md +379 -0
- package/src/agents/specific_instructions/applied_ml_scientist/review.md +142 -0
- package/src/agents/specific_instructions/applied_ml_scientist/validation_checklist.md +136 -0
- package/src/agents/specific_instructions/backend_engineer/clean.md +149 -0
- package/src/agents/specific_instructions/backend_engineer/review.md +91 -0
- package/src/agents/specific_instructions/backend_engineer/review_checklist.md +54 -0
- package/src/agents/specific_instructions/backend_engineer/service_mode.md +67 -0
- package/src/agents/specific_instructions/bi_engineer/advise.md +137 -0
- package/src/agents/specific_instructions/bi_engineer/data_analyst_handoff.md +77 -0
- package/src/agents/specific_instructions/bi_engineer/incoming_handoff.md +45 -0
- package/src/agents/specific_instructions/bi_engineer/phases/index.md +20 -0
- package/src/agents/specific_instructions/bi_engineer/phases/phase-1.md +164 -0
- package/src/agents/specific_instructions/bi_engineer/phases/phase-2.md +92 -0
- package/src/agents/specific_instructions/bi_engineer/phases/phase-3.md +121 -0
- package/src/agents/specific_instructions/bi_engineer/phases/phase-4.md +106 -0
- package/src/agents/specific_instructions/bi_engineer/phases.md +451 -0
- package/src/agents/specific_instructions/bi_engineer/review.md +166 -0
- package/src/agents/specific_instructions/bi_engineer/update.md +147 -0
- package/src/agents/specific_instructions/bi_engineer/validation_checklist.md +124 -0
- package/src/agents/specific_instructions/data_analyst/advise.md +138 -0
- package/src/agents/specific_instructions/data_analyst/explain.md +221 -0
- package/src/agents/specific_instructions/data_analyst/incoming_handoff.md +40 -0
- package/src/agents/specific_instructions/data_analyst/phases/index.md +20 -0
- package/src/agents/specific_instructions/data_analyst/phases/phase-1.md +159 -0
- package/src/agents/specific_instructions/data_analyst/phases/phase-2.md +112 -0
- package/src/agents/specific_instructions/data_analyst/phases/phase-3.md +265 -0
- package/src/agents/specific_instructions/data_analyst/phases/phase-4.md +100 -0
- package/src/agents/specific_instructions/data_analyst/phases.md +501 -0
- package/src/agents/specific_instructions/data_analyst/review.md +138 -0
- package/src/agents/specific_instructions/data_analyst/ui_mode.md +26 -0
- package/src/agents/specific_instructions/data_analyst/update.md +144 -0
- package/src/agents/specific_instructions/data_analyst/validation_checklist.md +95 -0
- package/src/agents/specific_instructions/data_engineer/advise.md +137 -0
- package/src/agents/specific_instructions/data_engineer/phases.md +466 -0
- package/src/agents/specific_instructions/data_engineer/phases_deep/index.md +23 -0
- package/src/agents/specific_instructions/data_engineer/phases_deep/phase-1.md +49 -0
- package/src/agents/specific_instructions/data_engineer/phases_deep/phase-2.md +93 -0
- package/src/agents/specific_instructions/data_engineer/phases_deep/phase-3.md +55 -0
- package/src/agents/specific_instructions/data_engineer/phases_deep/phase-4.md +48 -0
- package/src/agents/specific_instructions/data_engineer/phases_deep/phase-5.md +40 -0
- package/src/agents/specific_instructions/data_engineer/phases_deep/phase-6.md +102 -0
- package/src/agents/specific_instructions/data_engineer/phases_deep/phase-7.md +87 -0
- package/src/agents/specific_instructions/data_engineer/phases_quick/index.md +19 -0
- package/src/agents/specific_instructions/data_engineer/phases_quick/phase-1.md +45 -0
- package/src/agents/specific_instructions/data_engineer/phases_quick/phase-2.md +54 -0
- package/src/agents/specific_instructions/data_engineer/review.md +135 -0
- package/src/agents/specific_instructions/data_engineer/validation_checklist.md +136 -0
- package/src/agents/specific_instructions/data_modeller/advise.md +137 -0
- package/src/agents/specific_instructions/data_modeller/phases.md +581 -0
- package/src/agents/specific_instructions/data_modeller/phases_deep/index.md +23 -0
- package/src/agents/specific_instructions/data_modeller/phases_deep/phase-1.md +52 -0
- package/src/agents/specific_instructions/data_modeller/phases_deep/phase-2.md +113 -0
- package/src/agents/specific_instructions/data_modeller/phases_deep/phase-3.md +47 -0
- package/src/agents/specific_instructions/data_modeller/phases_deep/phase-4.md +51 -0
- package/src/agents/specific_instructions/data_modeller/phases_deep/phase-5.md +45 -0
- package/src/agents/specific_instructions/data_modeller/phases_deep/phase-6.md +105 -0
- package/src/agents/specific_instructions/data_modeller/phases_deep/phase-7.md +136 -0
- package/src/agents/specific_instructions/data_modeller/phases_quick/index.md +19 -0
- package/src/agents/specific_instructions/data_modeller/phases_quick/phase-1.md +47 -0
- package/src/agents/specific_instructions/data_modeller/phases_quick/phase-2.md +65 -0
- package/src/agents/specific_instructions/data_modeller/review.md +141 -0
- package/src/agents/specific_instructions/data_modeller/service_mode.md +218 -0
- package/src/agents/specific_instructions/data_modeller/validation_checklist.md +125 -0
- package/src/agents/specific_instructions/data_scientist/advise.md +158 -0
- package/src/agents/specific_instructions/data_scientist/bi_engineer_handoff.md +63 -0
- package/src/agents/specific_instructions/data_scientist/experiment.md +482 -0
- package/src/agents/specific_instructions/data_scientist/experiment_ui_mode.md +44 -0
- package/src/agents/specific_instructions/data_scientist/explain.md +247 -0
- package/src/agents/specific_instructions/data_scientist/greenfield_data.md +35 -0
- package/src/agents/specific_instructions/data_scientist/ml_engineer_handoff.md +52 -0
- package/src/agents/specific_instructions/data_scientist/notebook_walkthrough.md +76 -0
- package/src/agents/specific_instructions/data_scientist/phases/index.md +24 -0
- package/src/agents/specific_instructions/data_scientist/phases/phase-1.md +45 -0
- package/src/agents/specific_instructions/data_scientist/phases/phase-2.md +67 -0
- package/src/agents/specific_instructions/data_scientist/phases/phase-3.md +89 -0
- package/src/agents/specific_instructions/data_scientist/phases/phase-4.md +143 -0
- package/src/agents/specific_instructions/data_scientist/phases/phase-5.md +71 -0
- package/src/agents/specific_instructions/data_scientist/phases/phase-6.md +239 -0
- package/src/agents/specific_instructions/data_scientist/phases/phase-7.md +207 -0
- package/src/agents/specific_instructions/data_scientist/phases.md +651 -0
- package/src/agents/specific_instructions/data_scientist/research.md +345 -0
- package/src/agents/specific_instructions/data_scientist/research_ui_mode.md +52 -0
- package/src/agents/specific_instructions/data_scientist/review.md +136 -0
- package/src/agents/specific_instructions/data_scientist/service_mode.md +247 -0
- package/src/agents/specific_instructions/data_scientist/validation_checklist.md +183 -0
- package/src/agents/specific_instructions/deep_learning_engineer/advise.md +145 -0
- package/src/agents/specific_instructions/deep_learning_engineer/phases/index.md +21 -0
- package/src/agents/specific_instructions/deep_learning_engineer/phases/phase-1.md +74 -0
- package/src/agents/specific_instructions/deep_learning_engineer/phases/phase-2.md +98 -0
- package/src/agents/specific_instructions/deep_learning_engineer/phases/phase-3.md +76 -0
- package/src/agents/specific_instructions/deep_learning_engineer/phases/phase-4.md +128 -0
- package/src/agents/specific_instructions/deep_learning_engineer/phases/phase-5.md +292 -0
- package/src/agents/specific_instructions/deep_learning_engineer/phases.md +567 -0
- package/src/agents/specific_instructions/deep_learning_engineer/research.md +389 -0
- package/src/agents/specific_instructions/deep_learning_engineer/review.md +155 -0
- package/src/agents/specific_instructions/deep_learning_engineer/validation_checklist.md +147 -0
- package/src/agents/specific_instructions/ml_engineer/advise.md +174 -0
- package/src/agents/specific_instructions/ml_engineer/bi_engineer_handoff.md +71 -0
- package/src/agents/specific_instructions/ml_engineer/experiment.md +474 -0
- package/src/agents/specific_instructions/ml_engineer/experiment_ui_mode.md +44 -0
- package/src/agents/specific_instructions/ml_engineer/notebook_walkthrough.md +75 -0
- package/src/agents/specific_instructions/ml_engineer/phases/index.md +25 -0
- package/src/agents/specific_instructions/ml_engineer/phases/phase-1.md +49 -0
- package/src/agents/specific_instructions/ml_engineer/phases/phase-2.md +75 -0
- package/src/agents/specific_instructions/ml_engineer/phases/phase-3.md +124 -0
- package/src/agents/specific_instructions/ml_engineer/phases/phase-4.md +279 -0
- package/src/agents/specific_instructions/ml_engineer/phases/phase-5.md +160 -0
- package/src/agents/specific_instructions/ml_engineer/phases/phase-6-5.md +170 -0
- package/src/agents/specific_instructions/ml_engineer/phases/phase-6.md +295 -0
- package/src/agents/specific_instructions/ml_engineer/phases/phase-7.md +337 -0
- package/src/agents/specific_instructions/ml_engineer/phases.md +1068 -0
- package/src/agents/specific_instructions/ml_engineer/research.md +437 -0
- package/src/agents/specific_instructions/ml_engineer/research_ui_mode.md +71 -0
- package/src/agents/specific_instructions/ml_engineer/review.md +187 -0
- package/src/agents/specific_instructions/ml_engineer/service_mode.md +273 -0
- package/src/agents/specific_instructions/ml_engineer/validation_checklist.md +185 -0
- package/src/agents/specific_instructions/mlops_engineer/advise.md +139 -0
- package/src/agents/specific_instructions/mlops_engineer/phases/index.md +23 -0
- package/src/agents/specific_instructions/mlops_engineer/phases/phase-1.md +52 -0
- package/src/agents/specific_instructions/mlops_engineer/phases/phase-2.md +86 -0
- package/src/agents/specific_instructions/mlops_engineer/phases/phase-3.md +105 -0
- package/src/agents/specific_instructions/mlops_engineer/phases/phase-4.md +128 -0
- package/src/agents/specific_instructions/mlops_engineer/phases/phase-5.md +106 -0
- package/src/agents/specific_instructions/mlops_engineer/phases/phase-6.md +128 -0
- package/src/agents/specific_instructions/mlops_engineer/phases/phase-7.md +144 -0
- package/src/agents/specific_instructions/mlops_engineer/phases.md +671 -0
- package/src/agents/specific_instructions/mlops_engineer/review.md +164 -0
- package/src/agents/specific_instructions/mlops_engineer/service_mode.md +81 -0
- package/src/agents/specific_instructions/mlops_engineer/validation_checklist.md +151 -0
- package/src/agents/specific_instructions/researcher/critical_review.md +292 -0
- package/src/agents/specific_instructions/researcher/review_checklist.md +67 -0
- package/src/agents/specific_instructions/researcher/service_mode.md +224 -0
- package/src/agents/specific_instructions/shared/auto_verify_mode.md +141 -0
- package/src/agents/specific_instructions/shared/autonomous_research.md +1289 -0
- package/src/agents/specific_instructions/shared/behavioral_rules.md +36 -0
- package/src/agents/specific_instructions/shared/diverge_protocol.md +387 -0
- package/src/agents/specific_instructions/shared/engineering_guidelines.md +136 -0
- package/src/agents/specific_instructions/shared/experiment_versioning.md +184 -0
- package/src/agents/specific_instructions/shared/goal_mode.md +187 -0
- package/src/agents/specific_instructions/shared/incremental_testing.md +139 -0
- package/src/agents/specific_instructions/shared/intent_discovery.md +223 -0
- package/src/agents/specific_instructions/shared/join_path_protocol.md +168 -0
- package/src/agents/specific_instructions/shared/knowledge_checkpoint.md +83 -0
- package/src/agents/specific_instructions/shared/knowledge_harvest.md +220 -0
- package/src/agents/specific_instructions/shared/knowledge_retrieval.md +100 -0
- package/src/agents/specific_instructions/shared/notebook_walkthrough_protocol.md +367 -0
- package/src/agents/specific_instructions/shared/reviewer_verdict_protocol.md +74 -0
- package/src/agents/specific_instructions/shared/swarm_protocol.md +97 -0
- package/src/agents/specific_instructions/shared/validation_protocol.md +139 -0
- package/src/agents/specific_instructions/syn/arbiter.md +140 -0
- package/src/agents/specific_instructions/syn/brainstorm.md +550 -0
- package/src/agents/specific_instructions/syn/code_review.md +232 -0
- package/src/agents/specific_instructions/syn/diff.md +239 -0
- package/src/agents/specific_instructions/syn/final_review.md +65 -0
- package/src/agents/specific_instructions/syn/fixer.md +240 -0
- package/src/agents/specific_instructions/syn/free_form.md +130 -0
- package/src/agents/specific_instructions/syn/knowledge.md +468 -0
- package/src/agents/specific_instructions/syn/notebook_walkthrough.md +78 -0
- package/src/agents/specific_instructions/syn/panel_review.md +634 -0
- package/src/agents/specific_instructions/syn/pm.md +453 -0
- package/src/agents/specific_instructions/syn/pr_review.md +255 -0
- package/src/agents/specific_instructions/syn/slides.md +417 -0
- package/src/agents/syn.md +729 -0
- package/src/commands/academic.md +41 -0
- package/src/commands/ai-engineer.md +45 -0
- package/src/commands/analytics-engineer.md +48 -0
- package/src/commands/applied-ml-scientist.md +45 -0
- package/src/commands/backend-engineer.md +35 -0
- package/src/commands/bi-engineer.md +40 -0
- package/src/commands/brainstorm.md +24 -0
- package/src/commands/data-analyst.md +38 -0
- package/src/commands/data-engineer.md +37 -0
- package/src/commands/data-modeller.md +38 -0
- package/src/commands/data-scientist.md +38 -0
- package/src/commands/deep-learning-engineer.md +47 -0
- package/src/commands/end.md +49 -0
- package/src/commands/knowledge.md +24 -0
- package/src/commands/ml-engineer.md +42 -0
- package/src/commands/mlops-engineer.md +47 -0
- package/src/commands/notebook-walkthrough.md +58 -0
- package/src/commands/researcher.md +40 -0
- package/src/commands/resume.md +57 -0
- package/src/commands/review-pr.md +26 -0
- package/src/commands/shards-guide.md +41 -0
- package/src/commands/shards-ui.md +32 -0
- package/src/commands/shards.md +41 -0
- package/src/docs/01-getting-started/concepts.md +109 -0
- package/src/docs/01-getting-started/first-session.md +79 -0
- package/src/docs/01-getting-started/install.md +61 -0
- package/src/docs/02-agents/academic.md +71 -0
- package/src/docs/02-agents/ai-engineer.md +78 -0
- package/src/docs/02-agents/analytics-engineer.md +58 -0
- package/src/docs/02-agents/applied-ml-scientist.md +59 -0
- package/src/docs/02-agents/backend-engineer.md +58 -0
- package/src/docs/02-agents/bi-engineer.md +65 -0
- package/src/docs/02-agents/data-analyst.md +67 -0
- package/src/docs/02-agents/data-engineer.md +57 -0
- package/src/docs/02-agents/data-modeller.md +51 -0
- package/src/docs/02-agents/data-scientist.md +78 -0
- package/src/docs/02-agents/deep-learning-engineer.md +64 -0
- package/src/docs/02-agents/ml-engineer.md +80 -0
- package/src/docs/02-agents/mlops-engineer.md +59 -0
- package/src/docs/02-agents/overview.md +62 -0
- package/src/docs/02-agents/researcher.md +73 -0
- package/src/docs/02-agents/syn.md +88 -0
- package/src/docs/03-protocols/auto-verify.md +82 -0
- package/src/docs/03-protocols/autonomous-research.md +59 -0
- package/src/docs/03-protocols/behavioral-rules.md +35 -0
- package/src/docs/03-protocols/diverge.md +50 -0
- package/src/docs/03-protocols/engineering-guidelines.md +56 -0
- package/src/docs/03-protocols/experiment-versioning.md +38 -0
- package/src/docs/03-protocols/gate-pattern.md +65 -0
- package/src/docs/03-protocols/incremental-testing.md +68 -0
- package/src/docs/03-protocols/join-path.md +46 -0
- package/src/docs/03-protocols/knowledge-ledger.md +70 -0
- package/src/docs/03-protocols/reviewer-verdicts.md +39 -0
- package/src/docs/03-protocols/swarm.md +40 -0
- package/src/docs/03-protocols/validation.md +174 -0
- package/src/docs/04-ui/activity-bar.md +70 -0
- package/src/docs/04-ui/chat-pane.md +80 -0
- package/src/docs/04-ui/code-intel.md +62 -0
- package/src/docs/04-ui/file-editing.md +61 -0
- package/src/docs/04-ui/git.md +54 -0
- package/src/docs/04-ui/keybindings.md +79 -0
- package/src/docs/04-ui/knowledge-map.md +76 -0
- package/src/docs/04-ui/overview.md +93 -0
- package/src/docs/04-ui/panels.md +49 -0
- package/src/docs/04-ui/pinboard-selection.md +66 -0
- package/src/docs/04-ui/quick-open-palette.md +56 -0
- package/src/docs/04-ui/sessions.md +81 -0
- package/src/docs/04-ui/settings-permissions.md +56 -0
- package/src/docs/05-commands/reference.md +59 -0
- package/src/docs/06-outputs/directory-map.md +116 -0
- package/src/docs/07-workflows/ai-eval-first.md +57 -0
- package/src/docs/07-workflows/deep-study-to-production.md +76 -0
- package/src/docs/07-workflows/diverge-exploration.md +77 -0
- package/src/docs/07-workflows/quick-analysis.md +45 -0
- package/src/docs/08-integrations/claude-code-auto-mode.md +191 -0
- package/src/docs/08-integrations/google-slides.md +175 -0
- package/src/docs/README.md +30 -0
- package/src/docs/manifest.json +108 -0
- package/src/templates/analysis-template.md +20 -0
- package/src/templates/branch-report.md +46 -0
- package/src/templates/diff-report.md +88 -0
- package/src/templates/knowledge-index.md +7 -0
- package/src/templates/model-card-schema.json +186 -0
- package/src/templates/model-card-schema.md +88 -0
- package/src/templates/model-card.md +124 -0
- package/src/templates/project-plan.md +47 -0
- package/src/templates/project-specs.md +81 -0
- package/src/templates/report-template.md +43 -0
- package/src/templates/study-template.md +25 -0
- package/src/ui/cc-readonly.js +181 -0
- package/src/ui/chat-session.js +466 -0
- package/src/ui/css/base.css +136 -0
- package/src/ui/css/brainstorm.css +525 -0
- package/src/ui/css/chat.css +1405 -0
- package/src/ui/css/editor.css +546 -0
- package/src/ui/css/eval-dashboard.css +157 -0
- package/src/ui/css/experiment.css +237 -0
- package/src/ui/css/guide.css +186 -0
- package/src/ui/css/knowledge-map.css +383 -0
- package/src/ui/css/layout.css +431 -0
- package/src/ui/css/model-card.css +161 -0
- package/src/ui/css/notebook-walkthrough.css +271 -0
- package/src/ui/css/pr-review.css +403 -0
- package/src/ui/css/prompt-lab.css +325 -0
- package/src/ui/css/sessions.css +258 -0
- package/src/ui/css/sidebar.css +661 -0
- package/src/ui/css/terminal.css +113 -0
- package/src/ui/css/theme-light.css +542 -0
- package/src/ui/index.html +389 -0
- package/src/ui/js/agents.js +32 -0
- package/src/ui/js/bookmarks.js +230 -0
- package/src/ui/js/chat.js +1776 -0
- package/src/ui/js/code-intel.js +328 -0
- package/src/ui/js/command-palette.js +142 -0
- package/src/ui/js/events.js +591 -0
- package/src/ui/js/explorer.js +317 -0
- package/src/ui/js/file-view.js +477 -0
- package/src/ui/js/git.js +536 -0
- package/src/ui/js/guide.js +198 -0
- package/src/ui/js/hud.js +75 -0
- package/src/ui/js/init.js +351 -0
- package/src/ui/js/knowledge-map.js +906 -0
- package/src/ui/js/markdown.js +114 -0
- package/src/ui/js/monaco.js +164 -0
- package/src/ui/js/notebook-walkthrough.js +272 -0
- package/src/ui/js/notebook.js +448 -0
- package/src/ui/js/panels.js +2681 -0
- package/src/ui/js/pinboard.js +186 -0
- package/src/ui/js/quick-open.js +164 -0
- package/src/ui/js/selection-context.js +131 -0
- package/src/ui/js/sessions.js +256 -0
- package/src/ui/js/settings.js +476 -0
- package/src/ui/js/split-view.js +82 -0
- package/src/ui/js/state.js +343 -0
- package/src/ui/js/table.js +161 -0
- package/src/ui/js/tabs.js +284 -0
- package/src/ui/js/tabular.js +125 -0
- package/src/ui/js/terminal.js +354 -0
- package/src/ui/js/timeline.js +137 -0
- package/src/ui/js/utils.js +293 -0
- package/src/ui/notebook-kernel.py +790 -0
- package/src/ui/open-browser.js +55 -0
- package/src/ui/permission-pattern.js +42 -0
- package/src/ui/relay.js +513 -0
- package/src/ui/server.js +3072 -0
- package/src/ui/session-index.js +225 -0
- package/src/ui/shards_icon.png +0 -0
- package/src/ui/spawn-server.js +41 -0
- package/src/ui/symbol-index.js +813 -0
- package/src/ui/ui-push.js +177 -0
- package/tools/gate-hook/VALIDATION_SPEC.md +273 -0
- package/tools/gate-hook/__tests__/auto-verify.test.js +343 -0
- package/tools/gate-hook/auto-allowlist.js +179 -0
- package/tools/gate-hook/auto-state.js +68 -0
- package/tools/gate-hook/classify.js +21 -0
- package/tools/gate-hook/log.js +57 -0
- package/tools/gate-hook/parser.js +205 -0
- package/tools/gate-hook/sql-guard.js +230 -0
- package/tools/gate-hook/state.js +170 -0
- package/tools/gate-hook/sweep.js +139 -0
- package/tools/gate-hook/transcript.js +45 -0
- package/tools/gate-hook/validation.js +321 -0
- package/tools/gate-hook.js +475 -0
- package/tools/install.js +914 -0
- package/tools/shards-gates.js +311 -0
- package/tools/shards-sessions.js +261 -0
- package/tools/shards-ui.js +377 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════════════════════════
|
|
2
|
+
// Pinboard — drag-and-drop context shelf above chat input
|
|
3
|
+
// ═══════════════════════════════════════════════════════════════
|
|
4
|
+
|
|
5
|
+
// Pin types: { type: 'file', path, name } or { type: 'snippet', path, name, text, startLine, endLine }
|
|
6
|
+
|
|
7
|
+
function addPin(pin) {
|
|
8
|
+
// Deduplicate: don't add the same file twice (snippets can repeat)
|
|
9
|
+
if (pin.type === 'file') {
|
|
10
|
+
for (var i = 0; i < pinnedItems.length; i++) {
|
|
11
|
+
if (pinnedItems[i].type === 'file' && pinnedItems[i].path === pin.path) return;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
pinnedItems.push(pin);
|
|
15
|
+
renderPinboard();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function removePin(index) {
|
|
19
|
+
pinnedItems.splice(index, 1);
|
|
20
|
+
renderPinboard();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function clearAllPins() {
|
|
24
|
+
pinnedItems.length = 0;
|
|
25
|
+
renderPinboard();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function pinCurrentSelection() {
|
|
29
|
+
var ctx = captureSelectionContext();
|
|
30
|
+
if (!ctx) return;
|
|
31
|
+
addPin({
|
|
32
|
+
type: 'snippet',
|
|
33
|
+
path: ctx.filePath,
|
|
34
|
+
name: ctx.filePath.split('/').pop() +
|
|
35
|
+
(ctx.startLine != null
|
|
36
|
+
? ':' + ctx.startLine + (ctx.endLine !== ctx.startLine ? '-' + ctx.endLine : '')
|
|
37
|
+
: ''),
|
|
38
|
+
text: ctx.text,
|
|
39
|
+
startLine: ctx.startLine,
|
|
40
|
+
endLine: ctx.endLine,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function pinFileByPath(filePath) {
|
|
45
|
+
addPin({
|
|
46
|
+
type: 'file',
|
|
47
|
+
path: filePath,
|
|
48
|
+
name: filePath.split('/').pop(),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function renderPinboard() {
|
|
53
|
+
var el = document.getElementById('pinboard');
|
|
54
|
+
if (!el) return;
|
|
55
|
+
|
|
56
|
+
if (pinnedItems.length === 0) {
|
|
57
|
+
el.classList.remove('visible');
|
|
58
|
+
el.innerHTML = '';
|
|
59
|
+
if (typeof renderHud === 'function') renderHud();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
el.classList.add('visible');
|
|
64
|
+
var html = '<div class="pinboard-header">' +
|
|
65
|
+
'<span class="pinboard-label">Pinned Context</span>' +
|
|
66
|
+
'<button class="pinboard-clear" onclick="clearAllPins()" title="Clear all pins">× Clear</button>' +
|
|
67
|
+
'</div><div class="pinboard-chips">';
|
|
68
|
+
|
|
69
|
+
for (var i = 0; i < pinnedItems.length; i++) {
|
|
70
|
+
var pin = pinnedItems[i];
|
|
71
|
+
var icon = pin.type === 'file' ? '📄' : '✎';
|
|
72
|
+
var tooltip = pin.type === 'snippet'
|
|
73
|
+
? esc(pin.path) + (pin.startLine != null ? ':' + pin.startLine + '-' + pin.endLine : '')
|
|
74
|
+
: esc(pin.path);
|
|
75
|
+
html += '<span class="pin-chip" title="' + tooltip + '" data-index="' + i + '">' +
|
|
76
|
+
'<span class="pin-chip-icon">' + icon + '</span>' +
|
|
77
|
+
'<span class="pin-chip-name">' + esc(pin.name) + '</span>' +
|
|
78
|
+
'<button class="pin-chip-remove" onclick="removePin(' + i + ')" title="Unpin">×</button>' +
|
|
79
|
+
'</span>';
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
html += '</div>';
|
|
83
|
+
el.innerHTML = html;
|
|
84
|
+
if (typeof renderHud === 'function') renderHud();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// ─── Format pinned context for message prepending ───────────
|
|
88
|
+
|
|
89
|
+
async function formatPinnedContextForMessage(userMessage) {
|
|
90
|
+
if (pinnedItems.length === 0) return userMessage;
|
|
91
|
+
|
|
92
|
+
// Fetch all file contents in parallel
|
|
93
|
+
var fetches = pinnedItems.map(function(pin) {
|
|
94
|
+
if (pin.type === 'file') return fetchPinnedFileContent(pin.path);
|
|
95
|
+
return Promise.resolve(null);
|
|
96
|
+
});
|
|
97
|
+
var results = await Promise.all(fetches);
|
|
98
|
+
|
|
99
|
+
var sections = [];
|
|
100
|
+
for (var i = 0; i < pinnedItems.length; i++) {
|
|
101
|
+
var pin = pinnedItems[i];
|
|
102
|
+
if (pin.type === 'snippet') {
|
|
103
|
+
var fileRef = 'File: ' + pin.path;
|
|
104
|
+
if (pin.startLine != null) {
|
|
105
|
+
fileRef += pin.startLine === pin.endLine
|
|
106
|
+
? ' (line ' + pin.startLine + ')'
|
|
107
|
+
: ' (lines ' + pin.startLine + '-' + pin.endLine + ')';
|
|
108
|
+
}
|
|
109
|
+
sections.push(fileRef + '\n```\n' + pin.text + '\n```');
|
|
110
|
+
} else if (pin.type === 'file') {
|
|
111
|
+
var content = results[i];
|
|
112
|
+
if (content !== null) {
|
|
113
|
+
sections.push('File: ' + pin.path + '\n```\n' + content + '\n```');
|
|
114
|
+
} else {
|
|
115
|
+
sections.push('File: ' + pin.path + ' (could not read)');
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return '--- Pinned Context ---\n' + sections.join('\n\n') + '\n--- End Pinned Context ---\n\n' + userMessage;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async function fetchPinnedFileContent(filePath) {
|
|
124
|
+
try {
|
|
125
|
+
var res = await authFetch('/browse/file/text?path=' + encodeURIComponent(filePath));
|
|
126
|
+
if (!res.ok) return null;
|
|
127
|
+
var text = await res.text();
|
|
128
|
+
// Truncate very large files to keep context manageable
|
|
129
|
+
if (text.length > 20000) {
|
|
130
|
+
text = text.substring(0, 20000) + '\n... (truncated, ' + text.length + ' chars total)';
|
|
131
|
+
}
|
|
132
|
+
return text;
|
|
133
|
+
} catch (e) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// ─── Drag-and-drop handling ─────────────────────────────────
|
|
139
|
+
|
|
140
|
+
function initPinboardDropZone() {
|
|
141
|
+
var chatPane = document.getElementById('chat-pane');
|
|
142
|
+
if (!chatPane) return;
|
|
143
|
+
|
|
144
|
+
chatPane.addEventListener('dragover', function(e) {
|
|
145
|
+
if (!e.dataTransfer.types.includes('application/x-shards-file')) return;
|
|
146
|
+
e.preventDefault();
|
|
147
|
+
e.dataTransfer.dropEffect = 'copy';
|
|
148
|
+
var pinboard = document.getElementById('pinboard');
|
|
149
|
+
if (pinboard) pinboard.classList.add('drag-over');
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
chatPane.addEventListener('dragleave', function(e) {
|
|
153
|
+
// Only remove highlight if leaving the chat pane entirely
|
|
154
|
+
if (e.relatedTarget && chatPane.contains(e.relatedTarget)) return;
|
|
155
|
+
var pinboard = document.getElementById('pinboard');
|
|
156
|
+
if (pinboard) pinboard.classList.remove('drag-over');
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
chatPane.addEventListener('drop', function(e) {
|
|
160
|
+
var pinboard = document.getElementById('pinboard');
|
|
161
|
+
if (pinboard) pinboard.classList.remove('drag-over');
|
|
162
|
+
|
|
163
|
+
var filePath = e.dataTransfer.getData('application/x-shards-file');
|
|
164
|
+
if (!filePath) return;
|
|
165
|
+
e.preventDefault();
|
|
166
|
+
pinFileByPath(filePath);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function makeExplorerEntryDraggable(row, fullPath) {
|
|
171
|
+
row.setAttribute('draggable', 'true');
|
|
172
|
+
row.addEventListener('dragstart', function(e) {
|
|
173
|
+
e.dataTransfer.setData('application/x-shards-file', fullPath);
|
|
174
|
+
e.dataTransfer.setData('text/plain', fullPath);
|
|
175
|
+
e.dataTransfer.effectAllowed = 'copy';
|
|
176
|
+
row.classList.add('dragging');
|
|
177
|
+
// Show drop zone indicator
|
|
178
|
+
var pinboard = document.getElementById('pinboard');
|
|
179
|
+
if (pinboard) pinboard.classList.add('drop-target');
|
|
180
|
+
});
|
|
181
|
+
row.addEventListener('dragend', function() {
|
|
182
|
+
row.classList.remove('dragging');
|
|
183
|
+
var pinboard = document.getElementById('pinboard');
|
|
184
|
+
if (pinboard) pinboard.classList.remove('drop-target');
|
|
185
|
+
});
|
|
186
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════════════════════════
|
|
2
|
+
// Quick file picker (Cmd+P)
|
|
3
|
+
// ═══════════════════════════════════════════════════════════════
|
|
4
|
+
|
|
5
|
+
var quickOpenIdx = -1;
|
|
6
|
+
|
|
7
|
+
function toggleQuickOpen() {
|
|
8
|
+
var overlay = document.getElementById('quick-open-overlay');
|
|
9
|
+
var isVisible = overlay.classList.contains('visible');
|
|
10
|
+
if (isVisible) {
|
|
11
|
+
overlay.classList.remove('visible');
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
overlay.classList.add('visible');
|
|
15
|
+
var input = document.getElementById('quick-open-input');
|
|
16
|
+
input.value = '';
|
|
17
|
+
input.focus();
|
|
18
|
+
quickOpenIdx = -1;
|
|
19
|
+
renderQuickOpenResults('');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function getQuickOpenCandidates() {
|
|
23
|
+
// Combine open tabs + session-touched files, deduped
|
|
24
|
+
var seen = {};
|
|
25
|
+
var items = [];
|
|
26
|
+
// Open tabs first (most accessible)
|
|
27
|
+
for (var i = 0; i < fileTabOrder.length; i++) {
|
|
28
|
+
if (!seen[fileTabOrder[i]]) {
|
|
29
|
+
items.push(fileTabOrder[i]);
|
|
30
|
+
seen[fileTabOrder[i]] = true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Session files
|
|
34
|
+
sessionTouchedFiles.forEach(function(f) {
|
|
35
|
+
if (!seen[f]) {
|
|
36
|
+
items.push(f);
|
|
37
|
+
seen[f] = true;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return items;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function fuzzyMatch(query, str) {
|
|
44
|
+
query = query.toLowerCase();
|
|
45
|
+
str = str.toLowerCase();
|
|
46
|
+
if (!query) return true;
|
|
47
|
+
// Simple substring match — good enough for small file lists
|
|
48
|
+
return str.indexOf(query) !== -1;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function renderQuickOpenResults(query) {
|
|
52
|
+
var container = document.getElementById('quick-open-results');
|
|
53
|
+
|
|
54
|
+
// Symbol search mode: @ prefix
|
|
55
|
+
if (query.startsWith('@')) {
|
|
56
|
+
var symbolQuery = query.substring(1);
|
|
57
|
+
if (symbolQuery.length < 1) {
|
|
58
|
+
container.innerHTML = '<div class="overlay-empty">Type a symbol name to search...</div>';
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
renderSymbolSearchResults(container, symbolQuery);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
var candidates = getQuickOpenCandidates();
|
|
66
|
+
var filtered = candidates.filter(function(f) { return fuzzyMatch(query, f); });
|
|
67
|
+
|
|
68
|
+
if (filtered.length === 0) {
|
|
69
|
+
container.innerHTML = '<div class="overlay-empty">' + (candidates.length === 0 ? 'No files in session yet' : 'No matches') + '</div>';
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
container.innerHTML = '';
|
|
74
|
+
for (var i = 0; i < filtered.length; i++) {
|
|
75
|
+
var item = document.createElement('div');
|
|
76
|
+
item.className = 'overlay-item' + (i === quickOpenIdx ? ' active' : '');
|
|
77
|
+
item.textContent = filtered[i];
|
|
78
|
+
item.addEventListener('click', (function(path) {
|
|
79
|
+
return function() {
|
|
80
|
+
document.getElementById('quick-open-overlay').classList.remove('visible');
|
|
81
|
+
openFileFromExplorer(path);
|
|
82
|
+
};
|
|
83
|
+
})(filtered[i]));
|
|
84
|
+
container.appendChild(item);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
var symbolSearchDebounce = null;
|
|
89
|
+
|
|
90
|
+
function renderSymbolSearchResults(container, prefix) {
|
|
91
|
+
// Debounce server calls
|
|
92
|
+
if (symbolSearchDebounce) clearTimeout(symbolSearchDebounce);
|
|
93
|
+
symbolSearchDebounce = setTimeout(function() {
|
|
94
|
+
var currentFile = (typeof getCurrentFileKey === 'function' ? getCurrentFileKey() : '') || '';
|
|
95
|
+
authFetch('/symbols/completions?prefix=' + encodeURIComponent(prefix) + '&file=' + encodeURIComponent(currentFile))
|
|
96
|
+
.then(function(r) { return r.json(); })
|
|
97
|
+
.then(function(data) {
|
|
98
|
+
if (!data.completions || data.completions.length === 0) {
|
|
99
|
+
container.innerHTML = '<div class="overlay-empty">No symbols matching "' + esc(prefix) + '"</div>';
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
container.innerHTML = '';
|
|
103
|
+
for (var i = 0; i < data.completions.length; i++) {
|
|
104
|
+
var comp = data.completions[i];
|
|
105
|
+
var item = document.createElement('div');
|
|
106
|
+
item.className = 'overlay-item' + (i === quickOpenIdx ? ' active' : '');
|
|
107
|
+
var badge = typeof kindBadge === 'function' ? kindBadge(comp.kind) : comp.kind;
|
|
108
|
+
var badgeClass = typeof kindBadgeClass === 'function' ? kindBadgeClass(comp.kind) : 'ci-badge-other';
|
|
109
|
+
item.innerHTML = '<span class="ci-badge ' + badgeClass + '">' + esc(badge) + '</span> ' +
|
|
110
|
+
'<span class="ci-symbol-name">' + esc(comp.name) + '</span>' +
|
|
111
|
+
(comp.detail ? '<span class="ci-symbol-sig">' + esc(comp.detail) + '</span>' : '') +
|
|
112
|
+
'<span class="ci-symbol-file">' + esc(comp.file) + ':' + comp.line + '</span>';
|
|
113
|
+
item.addEventListener('click', (function(file, line) {
|
|
114
|
+
return function() {
|
|
115
|
+
document.getElementById('quick-open-overlay').classList.remove('visible');
|
|
116
|
+
navigateToDefinition(file, line);
|
|
117
|
+
};
|
|
118
|
+
})(comp.file, comp.line));
|
|
119
|
+
container.appendChild(item);
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
.catch(function() {
|
|
123
|
+
container.innerHTML = '<div class="overlay-empty">Symbol search unavailable</div>';
|
|
124
|
+
});
|
|
125
|
+
}, 150);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
document.getElementById('quick-open-input').addEventListener('input', function() {
|
|
129
|
+
quickOpenIdx = -1;
|
|
130
|
+
renderQuickOpenResults(this.value);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
document.getElementById('quick-open-input').addEventListener('keydown', function(e) {
|
|
134
|
+
var container = document.getElementById('quick-open-results');
|
|
135
|
+
var items = container.querySelectorAll('.overlay-item');
|
|
136
|
+
|
|
137
|
+
if (e.key === 'ArrowDown') {
|
|
138
|
+
e.preventDefault();
|
|
139
|
+
quickOpenIdx = Math.min(quickOpenIdx + 1, items.length - 1);
|
|
140
|
+
updateQuickOpenActive(items);
|
|
141
|
+
} else if (e.key === 'ArrowUp') {
|
|
142
|
+
e.preventDefault();
|
|
143
|
+
quickOpenIdx = Math.max(quickOpenIdx - 1, 0);
|
|
144
|
+
updateQuickOpenActive(items);
|
|
145
|
+
} else if (e.key === 'Enter') {
|
|
146
|
+
e.preventDefault();
|
|
147
|
+
if (quickOpenIdx >= 0 && items[quickOpenIdx]) {
|
|
148
|
+
items[quickOpenIdx].click();
|
|
149
|
+
} else if (items.length > 0) {
|
|
150
|
+
items[0].click();
|
|
151
|
+
}
|
|
152
|
+
} else if (e.key === 'Escape') {
|
|
153
|
+
document.getElementById('quick-open-overlay').classList.remove('visible');
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
function updateQuickOpenActive(items) {
|
|
158
|
+
for (var i = 0; i < items.length; i++) {
|
|
159
|
+
items[i].classList.toggle('active', i === quickOpenIdx);
|
|
160
|
+
}
|
|
161
|
+
if (items[quickOpenIdx]) {
|
|
162
|
+
items[quickOpenIdx].scrollIntoView({ block: 'nearest' });
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════════════════════════
|
|
2
|
+
// Selection context — captures file viewer selections for chat
|
|
3
|
+
// ═══════════════════════════════════════════════════════════════
|
|
4
|
+
|
|
5
|
+
function getSelectionFromMonaco() {
|
|
6
|
+
var editor = activeMonacoInstance || activeNotebookCellMonaco;
|
|
7
|
+
if (!editor) return null;
|
|
8
|
+
var sel = editor.getSelection();
|
|
9
|
+
if (!sel || sel.isEmpty()) return null;
|
|
10
|
+
var text = editor.getModel().getValueInRange(sel);
|
|
11
|
+
if (!text.trim()) return null;
|
|
12
|
+
var source = (editor === activeNotebookCellMonaco) ? 'notebook' : 'monaco';
|
|
13
|
+
return {
|
|
14
|
+
text: text,
|
|
15
|
+
startLine: sel.startLineNumber,
|
|
16
|
+
endLine: sel.endLineNumber,
|
|
17
|
+
source: source,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function getSelectionFromTextarea() {
|
|
22
|
+
var ta = document.getElementById('code-edit');
|
|
23
|
+
if (!ta || !ta.classList.contains('visible')) return null;
|
|
24
|
+
if (ta.selectionStart === ta.selectionEnd) return null;
|
|
25
|
+
var text = ta.value.substring(ta.selectionStart, ta.selectionEnd);
|
|
26
|
+
if (!text.trim()) return null;
|
|
27
|
+
var before = ta.value.substring(0, ta.selectionStart);
|
|
28
|
+
var startLine = (before.match(/\n/g) || []).length + 1;
|
|
29
|
+
var endLine = startLine + (text.match(/\n/g) || []).length;
|
|
30
|
+
return { text: text, startLine: startLine, endLine: endLine, source: 'textarea' };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function getSelectionFromCodeView() {
|
|
34
|
+
var sel = window.getSelection();
|
|
35
|
+
if (!sel || sel.isCollapsed) return null;
|
|
36
|
+
var codeView = document.getElementById('code-view');
|
|
37
|
+
if (!codeView || codeView.style.display === 'none') return null;
|
|
38
|
+
if (!codeView.contains(sel.anchorNode) || !codeView.contains(sel.focusNode)) return null;
|
|
39
|
+
var text = sel.toString();
|
|
40
|
+
if (!text.trim()) return null;
|
|
41
|
+
var fullText = codeView.textContent;
|
|
42
|
+
var selStart = fullText.indexOf(text);
|
|
43
|
+
var startLine = null;
|
|
44
|
+
var endLine = null;
|
|
45
|
+
if (selStart !== -1) {
|
|
46
|
+
startLine = (fullText.substring(0, selStart).match(/\n/g) || []).length + 1;
|
|
47
|
+
endLine = startLine + (text.match(/\n/g) || []).length;
|
|
48
|
+
}
|
|
49
|
+
return { text: text, startLine: startLine, endLine: endLine, source: 'codeview' };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function getSelectionFromMarkdown() {
|
|
53
|
+
var sel = window.getSelection();
|
|
54
|
+
if (!sel || sel.isCollapsed) return null;
|
|
55
|
+
var renderedView = document.getElementById('file-rendered-view');
|
|
56
|
+
if (!renderedView || !renderedView.classList.contains('visible')) return null;
|
|
57
|
+
if (!renderedView.contains(sel.anchorNode) || !renderedView.contains(sel.focusNode)) return null;
|
|
58
|
+
var text = sel.toString();
|
|
59
|
+
if (!text.trim()) return null;
|
|
60
|
+
return { text: text, startLine: null, endLine: null, source: 'markdown' };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function captureSelectionContext() {
|
|
64
|
+
var filePath = getCurrentFileKey();
|
|
65
|
+
if (!filePath || filePath === 'chat') return null;
|
|
66
|
+
|
|
67
|
+
var sel = getSelectionFromMonaco()
|
|
68
|
+
|| getSelectionFromTextarea()
|
|
69
|
+
|| getSelectionFromCodeView()
|
|
70
|
+
|| getSelectionFromMarkdown();
|
|
71
|
+
|
|
72
|
+
if (!sel) return null;
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
filePath: filePath,
|
|
76
|
+
startLine: sel.startLine,
|
|
77
|
+
endLine: sel.endLine,
|
|
78
|
+
text: sel.text,
|
|
79
|
+
source: sel.source,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function setSelectionContext(ctx) {
|
|
84
|
+
selectionContext = ctx;
|
|
85
|
+
renderSelectionContextIndicator();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function clearSelectionContext() {
|
|
89
|
+
selectionContext = null;
|
|
90
|
+
renderSelectionContextIndicator();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function renderSelectionContextIndicator() {
|
|
94
|
+
var el = document.getElementById('selection-context-indicator');
|
|
95
|
+
if (!el) return;
|
|
96
|
+
if (!selectionContext) {
|
|
97
|
+
el.classList.remove('visible');
|
|
98
|
+
el.innerHTML = '';
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
var ctx = selectionContext;
|
|
102
|
+
var fileName = ctx.filePath.split('/').pop();
|
|
103
|
+
var lineInfo = '';
|
|
104
|
+
if (ctx.startLine !== null) {
|
|
105
|
+
lineInfo = ctx.startLine === ctx.endLine
|
|
106
|
+
? ' L' + ctx.startLine
|
|
107
|
+
: ' L' + ctx.startLine + '-' + ctx.endLine;
|
|
108
|
+
}
|
|
109
|
+
var preview = ctx.text.trim();
|
|
110
|
+
if (preview.length > 80) preview = preview.substring(0, 77) + '...';
|
|
111
|
+
preview = preview.replace(/\n/g, ' ');
|
|
112
|
+
|
|
113
|
+
el.innerHTML =
|
|
114
|
+
'<span class="sel-ctx-label">Selection:</span>' +
|
|
115
|
+
'<span class="sel-ctx-file">' + esc(fileName + lineInfo) + '</span>' +
|
|
116
|
+
'<span class="sel-ctx-preview">' + esc(preview) + '</span>' +
|
|
117
|
+
'<button class="sel-ctx-dismiss" onclick="clearSelectionContext()" title="Remove selection context">×</button>';
|
|
118
|
+
el.classList.add('visible');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function formatSelectionContextForMessage(userMessage) {
|
|
122
|
+
if (!selectionContext) return userMessage;
|
|
123
|
+
var ctx = selectionContext;
|
|
124
|
+
var fileRef = 'File: ' + ctx.filePath;
|
|
125
|
+
if (ctx.startLine !== null) {
|
|
126
|
+
fileRef += ctx.startLine === ctx.endLine
|
|
127
|
+
? ' (line ' + ctx.startLine + ')'
|
|
128
|
+
: ' (lines ' + ctx.startLine + '-' + ctx.endLine + ')';
|
|
129
|
+
}
|
|
130
|
+
return '--- Selected Code ---\n' + fileRef + '\n```\n' + ctx.text + '\n```\n---\n\n' + userMessage;
|
|
131
|
+
}
|