claude-dev-env 2.9.0 → 2.11.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/CLAUDE.md +2 -2
- package/_shared/advisor/CLAUDE.md +3 -2
- package/_shared/advisor/advisor-protocol.md +74 -108
- package/_shared/advisor/reference/advisor-block.md +37 -0
- package/_shared/advisor/reference/cli-chain.md +45 -0
- package/_shared/advisor/reference/consult-format.md +41 -0
- package/_shared/advisor/reference/lifecycle.md +21 -0
- package/_shared/advisor/reference/sol-rung.md +31 -0
- package/_shared/advisor/reference/spawn-walk-log.md +31 -0
- package/_shared/advisor/reference/third-party-bind.md +30 -0
- package/_shared/advisor/reference/warm-up.md +33 -0
- package/_shared/advisor/scripts/codex_sol_advisor.py +449 -0
- package/_shared/advisor/scripts/config/advisor_scripts_constants/advisor_route_constants.py +21 -0
- package/_shared/advisor/scripts/config/advisor_scripts_constants/model_tier_run_validator_constants.py +19 -17
- package/_shared/advisor/scripts/config/advisor_scripts_constants/sol_advisor_constants.py +28 -0
- package/_shared/advisor/scripts/model_tier_run_validator.py +32 -9
- package/_shared/advisor/scripts/tests/test_codex_sol_advisor.py +474 -0
- package/_shared/advisor/scripts/tests/test_model_tier_run_validator.py +79 -0
- package/_shared/advisor/scripts/tests/test_tier_model_ids.py +39 -17
- package/_shared/advisor/scripts/tier_model_ids.py +24 -0
- package/_shared/pr-loop/CLAUDE.md +1 -1
- package/_shared/pr-loop/audit-contract.md +17 -6
- package/_shared/pr-loop/audit-reply-template.md +4 -4
- package/_shared/pr-loop/code-rules-gate.md +3 -5
- package/_shared/pr-loop/fix-protocol.md +2 -3
- package/_shared/pr-loop/gh-payloads.md +1 -1
- package/_shared/pr-loop/scripts/CLAUDE.md +1 -1
- package/_shared/pr-loop/scripts/README.md +1 -1
- package/_shared/pr-loop/scripts/code_rules_gate.py +2 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/gate_running.py +16 -1
- package/_shared/pr-loop/scripts/code_rules_gate_parts/git_blob_readers.py +11 -5
- package/_shared/pr-loop/scripts/preflight.py +9 -4
- package/_shared/pr-loop/scripts/reviews_disabled.py +50 -22
- package/_shared/pr-loop/scripts/tests/conftest.py +20 -0
- package/_shared/pr-loop/scripts/tests/test_claude_permissions_common.py +6 -6
- package/_shared/pr-loop/scripts/tests/test_reviews_disabled.py +50 -6
- package/_shared/pr-loop/scripts/tests/test_revoke_project_claude_permissions.py +1 -1
- package/_shared/pr-loop/state-schema.md +5 -14
- package/agents/CLAUDE.md +2 -2
- package/agents/clean-coder.md +58 -548
- package/agents/code-quality-agent.md +10 -2
- package/agents/code-verifier.md +1 -1
- package/agents/test_agent_frontmatter.py +32 -40
- package/audit-rubrics/CLAUDE.md +2 -1
- package/audit-rubrics/audit-categories.json +704 -0
- package/audit-rubrics/prompts/category-i-concurrency.md +1 -1
- package/bin/CLAUDE.md +16 -5
- package/bin/ever-shipped-skills.mjs +2 -0
- package/bin/install-plan.mjs +402 -0
- package/bin/install-transaction.mjs +455 -0
- package/bin/install.mjs +593 -147
- package/bin/install.plan.test.mjs +194 -0
- package/bin/install.profile-root.test.mjs +154 -0
- package/bin/install.profiles.test.mjs +253 -0
- package/bin/install.settings-defaults.test.mjs +200 -0
- package/bin/install.transaction.test.mjs +400 -0
- package/bin/install.uninstall-transaction.test.mjs +418 -0
- package/bin/merge_managed_permissions.mjs +130 -0
- package/bin/resolve-install-root.mjs +181 -0
- package/bin/select-install-targets.mjs +401 -0
- package/commands/CLAUDE.md +0 -2
- package/docs/references/CLAUDE.md +3 -1
- package/docs/references/advisor-tool.md +25 -7
- package/docs/references/prose-style-enforcement.md +25 -0
- package/docs/references/team-advisor-skill.md +3 -3
- package/docs/references/weak-executor-advisor.md +91 -0
- package/hooks/blocking/CLAUDE.md +6 -6
- package/hooks/blocking/_path_setup.py +9 -5
- package/hooks/blocking/code_rules_docstrings.py +124 -30
- package/hooks/blocking/code_rules_enforcer.py +161 -16
- package/hooks/blocking/code_rules_shared.py +40 -23
- package/hooks/blocking/config/CLAUDE.md +3 -5
- package/hooks/blocking/config/prose_style_enforcement_constants.py +38 -0
- package/hooks/blocking/config/test_prose_style_enforcement_constants.py +45 -0
- package/hooks/blocking/eli11_reply_enforcer.py +70 -113
- package/hooks/blocking/hedging_language_blocker.py +103 -20
- package/hooks/blocking/hook_prose_detector_consistency.py +6 -0
- package/hooks/blocking/intent_only_ending_blocker.py +6 -0
- package/hooks/blocking/plain_language_blocker.py +139 -20
- package/hooks/blocking/pre_tool_use_dispatcher.py +102 -20
- package/hooks/blocking/state_description_blocker.py +7 -1
- package/hooks/blocking/tdd_enforcer.py +8 -0
- package/hooks/blocking/test__path_setup.py +28 -0
- package/hooks/blocking/test_code_rules_enforcer_agent_home_tooling.py +99 -0
- package/hooks/blocking/test_code_rules_enforcer_docstring_args_span_scope.py +232 -10
- package/hooks/blocking/test_code_rules_enforcer_ephemeral.py +1 -1
- package/hooks/blocking/test_code_rules_enforcer_join_separator_magic.py +41 -0
- package/hooks/blocking/test_code_rules_enforcer_string_magic.py +98 -0
- package/hooks/blocking/test_eli11_reply_enforcer.py +98 -165
- package/hooks/blocking/test_fable_spawn_gate.py +18 -11
- package/hooks/blocking/test_hedging_language_blocker.py +120 -1
- package/hooks/blocking/test_hook_prose_detector_consistency.py +28 -8
- package/hooks/blocking/test_intent_only_ending_blocker.py +27 -2
- package/hooks/blocking/test_package_inventory_stale_blocker.py +11 -4
- package/hooks/blocking/test_plain_language_blocker.py +129 -19
- package/hooks/blocking/test_plain_language_blocker_allowlist.py +70 -26
- package/hooks/blocking/test_pre_tool_use_dispatcher.py +99 -26
- package/hooks/blocking/test_pre_tool_use_dispatcher_native.py +87 -50
- package/hooks/blocking/test_state_description_blocker.py +45 -2
- package/hooks/blocking/test_stop_dispatcher.py +11 -7
- package/hooks/blocking/test_volatile_path_in_post_blocker.py +12 -12
- package/hooks/blocking/volatile_path_in_post_blocker.py +2 -2
- package/hooks/hooks.json +15 -0
- package/hooks/hooks_constants/CLAUDE.md +14 -3
- package/hooks/hooks_constants/ask_user_question_shape.py +281 -0
- package/hooks/hooks_constants/code_rules_enforcer_constants.py +2 -1
- package/hooks/hooks_constants/eli11_reply_enforcer_constants.py +5 -12
- package/hooks/hooks_constants/hedging_uncertainty_constants.py +42 -0
- package/hooks/hooks_constants/issue_tracker_session_starter_constants.py +23 -0
- package/hooks/hooks_constants/orchestrator_auto_starter_constants.py +23 -0
- package/hooks/hooks_constants/piped_pytest_blocker_constants.py +4 -1
- package/hooks/hooks_constants/plain_language_blocker_constants.py +4 -1
- package/hooks/hooks_constants/pre_tool_use_dispatcher_constants.py +6 -0
- package/hooks/hooks_constants/project_paths_reader.py +31 -4
- package/hooks/hooks_constants/prose_matcher_precision_constants.py +40 -0
- package/hooks/hooks_constants/pytest_invocation.py +354 -0
- package/hooks/hooks_constants/session_start_injector.py +163 -0
- package/hooks/hooks_constants/session_start_injector_constants.py +46 -0
- package/hooks/hooks_constants/shell_command_pipeline.py +397 -0
- package/hooks/hooks_constants/shell_command_segments.py +5 -0
- package/hooks/hooks_constants/test_ask_user_question_shape.py +167 -0
- package/hooks/hooks_constants/test_project_paths_reader.py +29 -0
- package/hooks/hooks_constants/test_prose_metrics_parity.py +8 -0
- package/hooks/hooks_constants/test_pytest_invocation.py +130 -0
- package/hooks/hooks_constants/test_session_start_injector.py +168 -0
- package/hooks/hooks_constants/test_shell_command_pipeline.py +135 -0
- package/hooks/hooks_constants/volatile_path_in_post_blocker_constants.py +1 -1
- package/hooks/hooks_constants/working_style_prompt_constants.py +30 -0
- package/hooks/observability/CLAUDE.md +2 -0
- package/hooks/observability/prose_matcher_advisory.py +237 -0
- package/hooks/observability/test_prose_matcher_advisory.py +143 -0
- package/hooks/session/CLAUDE.md +9 -1
- package/hooks/session/_path_setup.py +13 -0
- package/hooks/session/issue_tracker_session_starter.py +135 -0
- package/hooks/session/orchestrator_auto_starter.py +100 -0
- package/hooks/session/test__path_setup.py +28 -0
- package/hooks/session/test_issue_tracker_session_starter.py +104 -0
- package/hooks/session/test_orchestrator_auto_starter.py +99 -0
- package/hooks/session/test_working_style_prompt.py +47 -0
- package/hooks/session/untracked_repo_detector.py +1 -24
- package/hooks/session/working_style_prompt.py +36 -0
- package/hooks/validators/_path_setup.py +19 -0
- package/hooks/validators/run_all_validators.py +8 -13
- package/installable-surfaces.manifest.json +21 -0
- package/output-styles/CLAUDE.md +1 -3
- package/package.json +4 -2
- package/rules/CLAUDE.md +1 -0
- package/rules/durable-post-artifacts.md +2 -2
- package/rules/eli11-replies.md +6 -1
- package/rules/hedging-claims.md +4 -2
- package/rules/long-horizon-autonomy.md +3 -1
- package/rules/opus5-communication-contract.md +45 -0
- package/rules/plain-language.md +2 -2
- package/rules/research-mode.md +1 -1
- package/scripts/CLAUDE.md +11 -0
- package/scripts/Sync-RepoMain.ps1 +215 -0
- package/scripts/active_capability_references.py +218 -0
- package/scripts/ci/windows-installer-lifecycle.ps1 +78 -0
- package/scripts/claude_chain_runner.py +394 -6
- package/scripts/claude_chain_usage.py +1 -1
- package/scripts/codex_compat_materializer.py +105 -85
- package/scripts/dev_env_scripts_constants/CLAUDE.md +2 -0
- package/scripts/dev_env_scripts_constants/active_capability_constants.py +46 -0
- package/scripts/dev_env_scripts_constants/claude_chain_constants.py +74 -0
- package/scripts/dev_env_scripts_constants/verify_installable_package_constants.py +116 -0
- package/scripts/profile-isolation-launchers/config/mcp-bundles.json +25 -0
- package/scripts/profile-isolation-launchers/config/profile-isolation-constants.mjs +60 -0
- package/scripts/profile-isolation-launchers/config/profiles.manifest.json +54 -0
- package/scripts/profile-isolation-launchers/config/shared-allowlist.json +64 -0
- package/scripts/profile-isolation-launchers/launcher-runtime.mjs +180 -0
- package/scripts/profile-isolation-launchers/lib/profile-manifest.mjs +288 -0
- package/scripts/profile-isolation-launchers/mcp-bundles.mjs +275 -0
- package/scripts/profile-isolation-launchers/profile-isolation-contract.test.mjs +221 -0
- package/scripts/profile-isolation-launchers/tests/launcher-runtime.test.mjs +108 -0
- package/scripts/profile-isolation-launchers/tests/mcp-bundles.test.mjs +147 -0
- package/scripts/profile-isolation-launchers/tests/shortcut-contract.test.ps1 +102 -0
- package/scripts/profile-isolation-launchers/tests/version-compatibility.test.mjs +210 -0
- package/scripts/profile-isolation-launchers/version-compatibility.mjs +299 -0
- package/scripts/profile-isolation-launchers/windows/shortcut-inventory.ps1 +127 -0
- package/scripts/profile-isolation-launchers/windows/shortcut-manifest.json +51 -0
- package/scripts/profile-isolation-launchers/windows/shortcut-reconcile.ps1 +77 -0
- package/scripts/spawn_grok_batch.py +3 -0
- package/scripts/test_active_capability_references.py +108 -0
- package/scripts/test_claude_chain_runner.py +414 -82
- package/scripts/test_claude_chain_usage.py +12 -12
- package/scripts/test_resolve_worker_spawn.py +2 -2
- package/scripts/test_verify_installable_package.py +208 -0
- package/scripts/tests/test_codex_compat_materializer.py +33 -0
- package/scripts/verify_installable_package.py +612 -0
- package/settings.json +10 -0
- package/skills/CLAUDE.md +2 -0
- package/skills/_shared/advisor/CLAUDE.md +1 -1
- package/skills/_shared/advisor/scripts/README.md +2 -0
- package/skills/_shared/pr-loop/scripts/CLAUDE.md +1 -0
- package/skills/_shared/pr-loop/scripts/audit_category_schema.py +355 -0
- package/skills/_shared/pr-loop/scripts/skills_pr_loop_constants/CLAUDE.md +1 -0
- package/skills/_shared/pr-loop/scripts/skills_pr_loop_constants/audit_category_schema_constants.py +32 -0
- package/skills/_shared/pr-loop/scripts/skills_pr_loop_constants/path_resolver_constants.py +7 -19
- package/skills/_shared/pr-loop/scripts/test_audit_category_schema.py +94 -0
- package/skills/_shared/pr-loop/scripts/test_build_audit_prompt.py +21 -0
- package/skills/autoconverge/reference/convergence.md +2 -1
- package/skills/autoconverge/reference/stop-conditions.md +5 -3
- package/skills/beat-sheet/SKILL.md +54 -0
- package/skills/beat-sheet/reference/visual-beats.md +29 -0
- package/skills/bugteam/CONSTRAINTS.md +4 -4
- package/skills/bugteam/EXAMPLES.md +1 -1
- package/skills/bugteam/reference/README.md +1 -1
- package/skills/e-code-review/SKILL.md +26 -5
- package/skills/e-code-review/reference/effort-evaluation.md +35 -0
- package/skills/e-code-review/reference/medium.md +15 -4
- package/skills/e-code-review/scripts/config/e_code_review_effort_constants/__init__.py +41 -0
- package/skills/e-code-review/scripts/config/e_code_review_effort_constants/effort_constants.py +40 -0
- package/skills/e-code-review/scripts/e_code_review_scripts_constants/finding_pipeline_constants.py +49 -0
- package/skills/e-code-review/scripts/effort_defaults_evidence.json +186 -0
- package/skills/e-code-review/scripts/effort_evaluation.py +362 -0
- package/skills/e-code-review/scripts/finding_pipeline.py +140 -0
- package/skills/e-code-review/scripts/fixtures/demanding.json +26 -0
- package/skills/e-code-review/scripts/fixtures/easy.json +14 -0
- package/skills/e-code-review/scripts/fixtures/medium.json +20 -0
- package/skills/e-code-review/scripts/grok_code_review.py +16 -7
- package/skills/e-code-review/scripts/test_effort_evaluation.py +180 -0
- package/skills/e-code-review/scripts/test_finding_pipeline.py +197 -0
- package/skills/e-code-review/scripts/test_grok_code_review.py +77 -0
- package/skills/grokify/SKILL.md +1 -1
- package/skills/grokify/templates/handoff-template.md +2 -2
- package/skills/orchestrator/SKILL.md +5 -4
- package/skills/plan-to-pr/scripts/create_packet.py +4 -4
- package/skills/plan-to-pr/scripts/load_skill_constants.py +41 -0
- package/skills/plan-to-pr/scripts/validate_packet.py +4 -4
- package/skills/plan-to-pr/scripts/validate_protocol.py +4 -1
- package/skills/plan-to-pr/scripts/validate_run.py +4 -1
- package/skills/pr-converge/scripts/check_convergence.py +21 -19
- package/skills/pr-converge/scripts/check_convergence_availability.py +50 -7
- package/skills/pr-converge/scripts/conftest.py +35 -0
- package/skills/pr-converge/scripts/test_check_convergence_availability.py +65 -0
- package/skills/pr-converge/scripts/test_check_convergence_codex.py +11 -1
- package/skills/pr-converge/scripts/test_check_convergence_contract.py +9 -2
- package/skills/pr-loop-cloud-transport/SKILL.md +1 -1
- package/skills/rebase/SKILL.md +15 -3
- package/skills/reviewer-gates/SKILL.md +2 -2
- package/skills/show/SKILL.md +51 -0
- package/skills/show/references/accessibility.md +7 -0
- package/skills/show/references/art.md +3 -0
- package/skills/show/references/charts.md +3 -0
- package/skills/show/references/core-design.md +14 -0
- package/skills/show/references/erds.md +3 -0
- package/skills/show/references/flowcharts.md +3 -0
- package/skills/show/references/host-and-html.md +3 -0
- package/skills/show/references/illustrative-diagrams.md +10 -0
- package/skills/show/references/interaction.md +3 -0
- package/skills/show/references/mockups.md +3 -0
- package/skills/show/references/quality-gates.md +7 -0
- package/skills/show/references/structural-diagrams.md +3 -0
- package/skills/show/references/subject-inventory.md +21 -0
- package/skills/show/references/svg-contract.md +22 -0
- package/skills/show/routing.yaml +30 -0
- package/skills/show/samples/pr1262-v2.svg +222 -0
- package/skills/show/scripts/README.md +6 -0
- package/skills/show/scripts/validate-artifact.py +91 -0
- package/skills/show/scripts/validate-package.py +18 -0
- package/skills/show/templates/html-widget.html +4 -0
- package/skills/show/templates/svg-base.svg +19 -0
- package/skills/show/tests/fixtures/css-var.svg +6 -0
- package/skills/show/tests/fixtures/dead-ref.svg +7 -0
- package/skills/show/tests/fixtures/filled-glyph.svg +8 -0
- package/skills/show/tests/fixtures/inherited-fill.svg +18 -0
- package/skills/show/tests/fixtures/invalid.svg +1 -0
- package/skills/show/tests/fixtures/large-canvas.svg +21 -0
- package/skills/show/tests/fixtures/unfilled-connector.svg +15 -0
- package/skills/show/tests/fixtures/valid.html +1 -0
- package/skills/show/tests/test_validate-artifact.py +74 -0
- package/skills/show/tests/test_validators.py +59 -0
- package/skills/show/workflows/create-visual.md +13 -0
- package/skills/show/workflows/review-visual.md +20 -0
- package/skills/split-pr/SKILL.md +85 -0
- package/skills/split-pr/reference/path-layers.md +16 -0
- package/skills/split-pr/reference/proposal-format.md +15 -0
- package/skills/split-pr/reference/split-further-loop.md +10 -0
- package/skills/split-pr/reference/splitting-principles.md +26 -0
- package/skills/split-pr/scripts/analyze_pr.py +279 -0
- package/skills/split-pr/scripts/categorize_files.py +106 -0
- package/skills/split-pr/scripts/config/__init__.py +1 -0
- package/skills/split-pr/scripts/config/dependency_constants.py +14 -0
- package/skills/split-pr/scripts/config/git_operations_constants.py +36 -0
- package/skills/split-pr/scripts/config/packing_constants.py +61 -0
- package/skills/split-pr/scripts/config/plan_constants.py +49 -0
- package/skills/split-pr/scripts/config/split_pr_constants.py +110 -0
- package/skills/split-pr/scripts/execute_split_slices.py +82 -0
- package/skills/split-pr/scripts/pack_files_into_slices.py +212 -0
- package/skills/split-pr/scripts/split_pr_dependency_graph.py +70 -0
- package/skills/split-pr/scripts/split_pr_git_operations.py +184 -0
- package/skills/split-pr/scripts/split_pr_layer_order.py +58 -0
- package/skills/split-pr/scripts/split_pr_paginate.py +119 -0
- package/skills/split-pr/scripts/split_pr_process_runner.py +52 -0
- package/skills/split-pr/scripts/split_pr_script_types.py +126 -0
- package/skills/split-pr/scripts/split_pr_title.py +41 -0
- package/skills/split-pr/scripts/test_analyze_pr.py +228 -0
- package/skills/split-pr/scripts/test_categorize_files.py +55 -0
- package/skills/split-pr/scripts/test_categorize_files_packing.py +59 -0
- package/skills/split-pr/scripts/test_execute_split_slices.py +99 -0
- package/skills/split-pr/scripts/test_split_pr_dependency_graph.py +47 -0
- package/skills/split-pr/scripts/test_split_pr_git_operations.py +125 -0
- package/skills/split-pr/scripts/test_split_pr_layer_order.py +36 -0
- package/skills/split-pr/scripts/test_split_pr_paginate.py +65 -0
- package/skills/split-pr/scripts/test_split_pr_script_types.py +73 -0
- package/skills/split-pr/scripts/test_split_pr_title.py +28 -0
- package/skills/split-pr/scripts/test_verify_dependency_graph.py +46 -0
- package/skills/split-pr/scripts/test_verify_plan.py +56 -0
- package/skills/split-pr/scripts/test_verify_plan_contract.py +50 -0
- package/skills/split-pr/scripts/test_verify_plan_path_normalization.py +45 -0
- package/skills/split-pr/scripts/verify_dependency_graph.py +111 -0
- package/skills/split-pr/scripts/verify_plan.py +139 -0
- package/skills/team-advisor/SKILL.md +7 -4
- package/skills/team-advisor/reference/advisor-docs-review.md +207 -0
- package/system-prompts/software-engineer.xml +11 -2
- package/commands/initialize.md +0 -90
- package/commands/stubcheck.md +0 -88
- package/output-styles/caveman-agent.md +0 -37
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { test } from 'node:test';
|
|
2
|
+
import { strict as assert } from 'node:assert';
|
|
3
|
+
import { mkdtempSync, readFileSync, rmSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { tmpdir } from 'node:os';
|
|
6
|
+
import {
|
|
7
|
+
listServerNamesForBundle,
|
|
8
|
+
loadMcpBundlesDocument,
|
|
9
|
+
materializeProfileMcpConfig,
|
|
10
|
+
readEffectiveMcpServerInventory,
|
|
11
|
+
resolveProfileMcpBundleId,
|
|
12
|
+
SUPPORTED_ACTIVATION_INTERFACE,
|
|
13
|
+
validateMcpBundlesDocument,
|
|
14
|
+
} from '../mcp-bundles.mjs';
|
|
15
|
+
|
|
16
|
+
test('mcp bundles document loads with lean and full inventories', () => {
|
|
17
|
+
const document = loadMcpBundlesDocument();
|
|
18
|
+
assert.equal(document.supportedActivationInterface, SUPPORTED_ACTIVATION_INTERFACE);
|
|
19
|
+
assert.ok(document.bundles.lean.allServerNames.length >= 1);
|
|
20
|
+
assert.ok(document.bundles.full.allServerNames.length >= document.bundles.lean.allServerNames.length);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test('profile-a and profile-b resolve to lean mcp bundles from the profiles manifest', () => {
|
|
24
|
+
assert.equal(resolveProfileMcpBundleId('profile-a'), 'lean');
|
|
25
|
+
assert.equal(resolveProfileMcpBundleId('profile-b'), 'lean');
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('materializeProfileMcpConfig writes mcp.json inventory for profile-a', () => {
|
|
29
|
+
const claudeConfigDir = mkdtempSync(join(tmpdir(), 'mcp-profile-a-'));
|
|
30
|
+
try {
|
|
31
|
+
const result = materializeProfileMcpConfig({
|
|
32
|
+
profileId: 'profile-a',
|
|
33
|
+
claudeConfigDir,
|
|
34
|
+
});
|
|
35
|
+
assert.equal(result.activationInterface, SUPPORTED_ACTIVATION_INTERFACE);
|
|
36
|
+
assert.equal(result.bundleId, 'lean');
|
|
37
|
+
const inventory = readEffectiveMcpServerInventory(result.mcpConfigPath);
|
|
38
|
+
assert.deepEqual(inventory, [...result.allServerNames].sort());
|
|
39
|
+
const document = JSON.parse(readFileSync(result.mcpConfigPath, 'utf8'));
|
|
40
|
+
assert.ok(document.mcpServers['filesystem-readonly']);
|
|
41
|
+
} finally {
|
|
42
|
+
rmSync(claudeConfigDir, { recursive: true, force: true });
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test('materializeProfileMcpConfig writes mcp.json inventory for profile-b', () => {
|
|
47
|
+
const claudeConfigDir = mkdtempSync(join(tmpdir(), 'mcp-profile-b-'));
|
|
48
|
+
try {
|
|
49
|
+
const result = materializeProfileMcpConfig({
|
|
50
|
+
profileId: 'profile-b',
|
|
51
|
+
claudeConfigDir,
|
|
52
|
+
});
|
|
53
|
+
assert.equal(result.bundleId, 'lean');
|
|
54
|
+
const inventory = readEffectiveMcpServerInventory(result.mcpConfigPath);
|
|
55
|
+
assert.deepEqual(inventory, listServerNamesForBundle('lean').sort());
|
|
56
|
+
} finally {
|
|
57
|
+
rmSync(claudeConfigDir, { recursive: true, force: true });
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('unknown profile id fails with an actionable message', () => {
|
|
62
|
+
assert.throws(
|
|
63
|
+
() => resolveProfileMcpBundleId('not-a-profile'),
|
|
64
|
+
/unknown profile id/,
|
|
65
|
+
);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('malformed bundles document is rejected', () => {
|
|
69
|
+
assert.throws(
|
|
70
|
+
() => validateMcpBundlesDocument({ schemaVersion: 2 }),
|
|
71
|
+
/schemaVersion must be 1/,
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('missing mcp config readback fails closed', () => {
|
|
76
|
+
const claudeConfigDir = mkdtempSync(join(tmpdir(), 'mcp-missing-'));
|
|
77
|
+
try {
|
|
78
|
+
assert.throws(
|
|
79
|
+
() => readEffectiveMcpServerInventory(join(claudeConfigDir, 'mcp.json')),
|
|
80
|
+
/mcp config missing/,
|
|
81
|
+
);
|
|
82
|
+
} finally {
|
|
83
|
+
rmSync(claudeConfigDir, { recursive: true, force: true });
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('malformed mcp config readback fails closed', () => {
|
|
88
|
+
const claudeConfigDir = mkdtempSync(join(tmpdir(), 'mcp-bad-'));
|
|
89
|
+
try {
|
|
90
|
+
mkdirSync(claudeConfigDir, { recursive: true });
|
|
91
|
+
const path = join(claudeConfigDir, 'mcp.json');
|
|
92
|
+
writeFileSync(path, '{"notServers":true}\n', 'utf8');
|
|
93
|
+
assert.throws(
|
|
94
|
+
() => readEffectiveMcpServerInventory(path),
|
|
95
|
+
/malformed/,
|
|
96
|
+
);
|
|
97
|
+
} finally {
|
|
98
|
+
rmSync(claudeConfigDir, { recursive: true, force: true });
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('lean inventory must be a subset of full', () => {
|
|
103
|
+
assert.throws(
|
|
104
|
+
() => validateMcpBundlesDocument({
|
|
105
|
+
schemaVersion: 1,
|
|
106
|
+
supportedActivationInterface: SUPPORTED_ACTIVATION_INTERFACE,
|
|
107
|
+
mcpConfigFileName: 'mcp.json',
|
|
108
|
+
bundles: {
|
|
109
|
+
lean: { id: 'lean', allServerNames: ['only-lean'] },
|
|
110
|
+
full: { id: 'full', allServerNames: ['other'] },
|
|
111
|
+
},
|
|
112
|
+
serverByName: {
|
|
113
|
+
'only-lean': { command: 'npx', args: [] },
|
|
114
|
+
other: { command: 'npx', args: [] },
|
|
115
|
+
},
|
|
116
|
+
}),
|
|
117
|
+
/lean server only-lean must also appear in full/,
|
|
118
|
+
);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
test('bundles and serverByName reject arrays', () => {
|
|
122
|
+
assert.throws(
|
|
123
|
+
() => validateMcpBundlesDocument({
|
|
124
|
+
schemaVersion: 1,
|
|
125
|
+
supportedActivationInterface: SUPPORTED_ACTIVATION_INTERFACE,
|
|
126
|
+
mcpConfigFileName: 'mcp.json',
|
|
127
|
+
bundles: [],
|
|
128
|
+
serverByName: {},
|
|
129
|
+
}),
|
|
130
|
+
/bundles must be an object/,
|
|
131
|
+
);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
test('invalid JSON mcp config readback fails closed as malformed', () => {
|
|
135
|
+
const claudeConfigDir = mkdtempSync(join(tmpdir(), 'mcp-json-'));
|
|
136
|
+
try {
|
|
137
|
+
mkdirSync(claudeConfigDir, { recursive: true });
|
|
138
|
+
const path = join(claudeConfigDir, 'mcp.json');
|
|
139
|
+
writeFileSync(path, '{not-json', 'utf8');
|
|
140
|
+
assert.throws(
|
|
141
|
+
() => readEffectiveMcpServerInventory(path),
|
|
142
|
+
/malformed/,
|
|
143
|
+
);
|
|
144
|
+
} finally {
|
|
145
|
+
rmSync(claudeConfigDir, { recursive: true, force: true });
|
|
146
|
+
}
|
|
147
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Contract tests for N1 shortcut source semantics (read-only slice).
|
|
2
|
+
# Run: pwsh -NoProfile -File tests/shortcut-contract.test.ps1
|
|
3
|
+
|
|
4
|
+
Set-StrictMode -Version Latest
|
|
5
|
+
$ErrorActionPreference = 'Stop'
|
|
6
|
+
|
|
7
|
+
$packageLaunchersRoot = Split-Path -Parent $PSScriptRoot
|
|
8
|
+
$manifestPath = Join-Path $packageLaunchersRoot 'windows\shortcut-manifest.json'
|
|
9
|
+
$inventoryScript = Join-Path $packageLaunchersRoot 'windows\shortcut-inventory.ps1'
|
|
10
|
+
$reconcileScript = Join-Path $packageLaunchersRoot 'windows\shortcut-reconcile.ps1'
|
|
11
|
+
|
|
12
|
+
$script:allFailures = @()
|
|
13
|
+
|
|
14
|
+
function Assert-True {
|
|
15
|
+
param([bool]$Condition, [string]$Message)
|
|
16
|
+
if (-not $Condition) {
|
|
17
|
+
$script:allFailures += $Message
|
|
18
|
+
Write-Host "FAIL: $Message"
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
Write-Host "PASS: $Message"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
# Manifest loads with provisional native-Desktop-wins policy.
|
|
26
|
+
$manifest = Get-Content -LiteralPath $manifestPath -Raw | ConvertFrom-Json
|
|
27
|
+
Assert-True ($manifest.schemaVersion -eq 1) 'manifest schemaVersion is 1'
|
|
28
|
+
Assert-True ($manifest.policy.liveMutationAuthorized -eq $false) 'live mutation stays unauthorized until owner confirmation'
|
|
29
|
+
Assert-True ($manifest.policy.unsuffixedNames -match 'Native Desktop wins') 'provisional unsuffixed policy is native Desktop wins'
|
|
30
|
+
Assert-True ($manifest.policy.browserNames -match 'Chrome') 'browser names require explicit Chrome/Web labels'
|
|
31
|
+
|
|
32
|
+
# Every managed shortcut has one source, profile, and grouping identity.
|
|
33
|
+
$allVisibleNames = @{}
|
|
34
|
+
$allGrouping = @{}
|
|
35
|
+
foreach ($eachShortcut in $manifest.allManagedShortcuts) {
|
|
36
|
+
Assert-True ([string]::IsNullOrWhiteSpace($eachShortcut.id) -eq $false) "shortcut id present"
|
|
37
|
+
Assert-True ([string]::IsNullOrWhiteSpace($eachShortcut.source) -eq $false) "$($eachShortcut.id) has source"
|
|
38
|
+
Assert-True ([string]::IsNullOrWhiteSpace($eachShortcut.profileId) -eq $false) "$($eachShortcut.id) has profileId"
|
|
39
|
+
Assert-True ([string]::IsNullOrWhiteSpace($eachShortcut.groupingIdentity) -eq $false) "$($eachShortcut.id) has groupingIdentity"
|
|
40
|
+
Assert-True ([string]::IsNullOrWhiteSpace($eachShortcut.visibleName) -eq $false) "$($eachShortcut.id) has visibleName"
|
|
41
|
+
if ($allVisibleNames.ContainsKey($eachShortcut.visibleName)) {
|
|
42
|
+
Assert-True $false "duplicate visible name: $($eachShortcut.visibleName)"
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
$allVisibleNames[$eachShortcut.visibleName] = $eachShortcut.id
|
|
46
|
+
Assert-True $true "unique visible name: $($eachShortcut.visibleName)"
|
|
47
|
+
}
|
|
48
|
+
if ($allGrouping.ContainsKey($eachShortcut.groupingIdentity)) {
|
|
49
|
+
Assert-True $false "duplicate grouping identity: $($eachShortcut.groupingIdentity)"
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
$allGrouping[$eachShortcut.groupingIdentity] = $eachShortcut.id
|
|
53
|
+
Assert-True $true "unique grouping identity: $($eachShortcut.groupingIdentity)"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
# Native and Chrome variants retain distinct grouping identity for profile-a and profile-b.
|
|
58
|
+
$profileANative = $manifest.allManagedShortcuts | Where-Object { $_.id -eq 'desktop-profile-a-native' }
|
|
59
|
+
$profileAChrome = $manifest.allManagedShortcuts | Where-Object { $_.id -eq 'start-profile-a-chrome' }
|
|
60
|
+
Assert-True ($profileANative.groupingIdentity -ne $profileAChrome.groupingIdentity) 'profile-a native/chrome grouping differs'
|
|
61
|
+
Assert-True ($profileANative.source -eq 'native-desktop') 'profile-a desktop source is native-desktop'
|
|
62
|
+
Assert-True ($profileAChrome.source -eq 'chrome-start-menu') 'profile-a start-menu source is chrome-start-menu'
|
|
63
|
+
|
|
64
|
+
# Inventory is read-only against disposable paths.
|
|
65
|
+
$tempRoot = Join-Path ([IO.Path]::GetTempPath()) ("shortcut-contract-" + [guid]::NewGuid().ToString('n'))
|
|
66
|
+
$desktop = Join-Path $tempRoot 'Desktop'
|
|
67
|
+
$startMenu = Join-Path $tempRoot 'StartMenu'
|
|
68
|
+
New-Item -ItemType Directory -Path $desktop, $startMenu | Out-Null
|
|
69
|
+
try {
|
|
70
|
+
$inventoryJson = & $inventoryScript -ManifestPath $manifestPath -DesktopPath $desktop -StartMenuPath $startMenu
|
|
71
|
+
$inventory = $inventoryJson | ConvertFrom-Json
|
|
72
|
+
Assert-True ($inventory.mode -eq 'read-only-inventory') 'inventory mode is read-only'
|
|
73
|
+
Assert-True ($inventory.shortcuts.Count -eq $manifest.allManagedShortcuts.Count) 'inventory rows match manifest'
|
|
74
|
+
Assert-True (-not (Get-ChildItem -LiteralPath $desktop -Force | Where-Object { $_.Extension -eq '.lnk' })) 'inventory does not create desktop shortcuts'
|
|
75
|
+
Assert-True (-not (Get-ChildItem -LiteralPath $startMenu -Force | Where-Object { $_.Extension -eq '.lnk' })) 'inventory does not create start-menu shortcuts'
|
|
76
|
+
|
|
77
|
+
$previewJson = & $reconcileScript -ManifestPath $manifestPath -DesktopPath $desktop -StartMenuPath $startMenu
|
|
78
|
+
$preview = $previewJson | ConvertFrom-Json
|
|
79
|
+
Assert-True ($preview.mode -eq 'preview-only') 'reconcile defaults to preview-only'
|
|
80
|
+
Assert-True ($preview.liveMutationAuthorized -eq $false) 'preview reports mutation unauthorized'
|
|
81
|
+
Assert-True ($preview.actions.Count -eq $manifest.allManagedShortcuts.Count) 'preview lists every managed shortcut'
|
|
82
|
+
|
|
83
|
+
$applyFailed = $false
|
|
84
|
+
try {
|
|
85
|
+
& $reconcileScript -ManifestPath $manifestPath -DesktopPath $desktop -StartMenuPath $startMenu -Apply | Out-Null
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
$applyFailed = $true
|
|
89
|
+
Assert-True ($_.Exception.Message -match 'live shortcut mutation refused') 'apply refuses without owner authorization'
|
|
90
|
+
}
|
|
91
|
+
Assert-True $applyFailed 'apply path must throw while unauthorized'
|
|
92
|
+
}
|
|
93
|
+
finally {
|
|
94
|
+
Remove-Item -Recurse -Force -Confirm:$false -LiteralPath $tempRoot
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if ($script:allFailures.Count -gt 0) {
|
|
98
|
+
Write-Host ("FAILED {0} assertion(s)" -f $script:allFailures.Count)
|
|
99
|
+
exit 1
|
|
100
|
+
}
|
|
101
|
+
Write-Host 'shortcut-contract: all assertions passed'
|
|
102
|
+
exit 0
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI / Desktop version compatibility contract (control-plane K1 / P-26).
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { test } from 'node:test';
|
|
6
|
+
import { strict as assert } from 'node:assert';
|
|
7
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
8
|
+
import { join, dirname } from 'node:path';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { spawnSync } from 'node:child_process';
|
|
11
|
+
import {
|
|
12
|
+
classifyVersionCompatibility,
|
|
13
|
+
shouldBlockLaunch,
|
|
14
|
+
parseSemver,
|
|
15
|
+
COMPATIBILITY_POLICY_VERSION,
|
|
16
|
+
COMPATIBILITY_ACTION_BY_CLASS,
|
|
17
|
+
} from '../version-compatibility.mjs';
|
|
18
|
+
import {
|
|
19
|
+
evaluateLauncherVersionCompatibility,
|
|
20
|
+
formatCompatibilityPreflightFailure,
|
|
21
|
+
} from '../launcher-runtime.mjs';
|
|
22
|
+
|
|
23
|
+
const PACKAGE_ROOT = join(
|
|
24
|
+
dirname(fileURLToPath(import.meta.url)),
|
|
25
|
+
'..',
|
|
26
|
+
'..',
|
|
27
|
+
'..',
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
test('action table covers every compatibility class and fails closed', () => {
|
|
31
|
+
const allExpectedClasses = [
|
|
32
|
+
'equal',
|
|
33
|
+
'patch-drift',
|
|
34
|
+
'minor-drift',
|
|
35
|
+
'major-drift',
|
|
36
|
+
'missing-binary',
|
|
37
|
+
'unreadable',
|
|
38
|
+
'process-error',
|
|
39
|
+
'non-semver',
|
|
40
|
+
];
|
|
41
|
+
for (const eachClass of allExpectedClasses) {
|
|
42
|
+
assert.ok(
|
|
43
|
+
Object.hasOwn(COMPATIBILITY_ACTION_BY_CLASS, eachClass),
|
|
44
|
+
`missing action for ${eachClass}`,
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
assert.equal(COMPATIBILITY_ACTION_BY_CLASS.equal, 'pass');
|
|
48
|
+
assert.equal(COMPATIBILITY_ACTION_BY_CLASS['patch-drift'], 'warn');
|
|
49
|
+
assert.equal(COMPATIBILITY_ACTION_BY_CLASS['minor-drift'], 'block');
|
|
50
|
+
assert.equal(COMPATIBILITY_ACTION_BY_CLASS['major-drift'], 'block');
|
|
51
|
+
assert.equal(COMPATIBILITY_ACTION_BY_CLASS['missing-binary'], 'block');
|
|
52
|
+
assert.equal(COMPATIBILITY_ACTION_BY_CLASS.unreadable, 'block');
|
|
53
|
+
assert.equal(COMPATIBILITY_ACTION_BY_CLASS['process-error'], 'block');
|
|
54
|
+
assert.equal(COMPATIBILITY_ACTION_BY_CLASS['non-semver'], 'block');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test('equal versions pass with both paths, versions, and policy version', () => {
|
|
58
|
+
const result = classifyVersionCompatibility({
|
|
59
|
+
cli: { path: 'C:\\cli\\claude.exe', versionText: '2.1.220' },
|
|
60
|
+
desktop: { path: 'C:\\desktop\\claude.exe', versionText: '2.1.220' },
|
|
61
|
+
});
|
|
62
|
+
assert.equal(result.class, 'equal');
|
|
63
|
+
assert.equal(result.action, 'pass');
|
|
64
|
+
assert.equal(result.policyVersion, COMPATIBILITY_POLICY_VERSION);
|
|
65
|
+
assert.equal(result.cliPath, 'C:\\cli\\claude.exe');
|
|
66
|
+
assert.equal(result.desktopPath, 'C:\\desktop\\claude.exe');
|
|
67
|
+
assert.equal(result.cliVersion, '2.1.220');
|
|
68
|
+
assert.equal(result.desktopVersion, '2.1.220');
|
|
69
|
+
assert.equal(shouldBlockLaunch(result), false);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('patch drift warns and identifies the runtime pair', () => {
|
|
73
|
+
const result = classifyVersionCompatibility({
|
|
74
|
+
cli: { path: 'cli', versionText: '2.1.220' },
|
|
75
|
+
desktop: { path: 'desktop', versionText: '2.1.219' },
|
|
76
|
+
});
|
|
77
|
+
assert.equal(result.class, 'patch-drift');
|
|
78
|
+
assert.equal(result.action, 'warn');
|
|
79
|
+
assert.match(result.message, /patch drift/i);
|
|
80
|
+
assert.equal(shouldBlockLaunch(result), false);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test('minor and major drift block before mutation', () => {
|
|
84
|
+
const minor = classifyVersionCompatibility({
|
|
85
|
+
cli: { path: 'cli', versionText: '2.1.220' },
|
|
86
|
+
desktop: { path: 'desktop', versionText: '2.0.100' },
|
|
87
|
+
});
|
|
88
|
+
assert.equal(minor.class, 'minor-drift');
|
|
89
|
+
assert.equal(minor.action, 'block');
|
|
90
|
+
assert.equal(shouldBlockLaunch(minor), true);
|
|
91
|
+
|
|
92
|
+
const major = classifyVersionCompatibility({
|
|
93
|
+
cli: { path: 'cli', versionText: '2.1.220' },
|
|
94
|
+
desktop: { path: 'desktop', versionText: '1.9.0' },
|
|
95
|
+
});
|
|
96
|
+
assert.equal(major.class, 'major-drift');
|
|
97
|
+
assert.equal(major.action, 'block');
|
|
98
|
+
assert.equal(shouldBlockLaunch(major), true);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test('missing, unreadable, process-error, and non-semver block', () => {
|
|
102
|
+
const missing = classifyVersionCompatibility({
|
|
103
|
+
cli: { path: null, versionText: null, errorCode: 'missing' },
|
|
104
|
+
desktop: { path: 'desktop', versionText: '2.1.220' },
|
|
105
|
+
});
|
|
106
|
+
assert.equal(missing.class, 'missing-binary');
|
|
107
|
+
assert.equal(missing.action, 'block');
|
|
108
|
+
|
|
109
|
+
const unreadable = classifyVersionCompatibility({
|
|
110
|
+
cli: { path: 'cli', versionText: null, errorCode: 'unreadable' },
|
|
111
|
+
desktop: { path: 'desktop', versionText: '2.1.220' },
|
|
112
|
+
});
|
|
113
|
+
assert.equal(unreadable.class, 'unreadable');
|
|
114
|
+
assert.equal(unreadable.action, 'block');
|
|
115
|
+
|
|
116
|
+
const processError = classifyVersionCompatibility({
|
|
117
|
+
cli: {
|
|
118
|
+
path: 'cli',
|
|
119
|
+
versionText: null,
|
|
120
|
+
errorCode: 'process-error',
|
|
121
|
+
errorMessage: 'exit 127',
|
|
122
|
+
},
|
|
123
|
+
desktop: { path: 'desktop', versionText: '2.1.220' },
|
|
124
|
+
});
|
|
125
|
+
assert.equal(processError.class, 'process-error');
|
|
126
|
+
assert.equal(processError.action, 'block');
|
|
127
|
+
assert.match(processError.message, /exit 127/);
|
|
128
|
+
|
|
129
|
+
const nonSemver = classifyVersionCompatibility({
|
|
130
|
+
cli: { path: 'cli', versionText: 'unknown' },
|
|
131
|
+
desktop: { path: 'desktop', versionText: '2.1.220' },
|
|
132
|
+
});
|
|
133
|
+
assert.equal(nonSemver.class, 'non-semver');
|
|
134
|
+
assert.equal(nonSemver.action, 'block');
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
test('parseSemver reads the first major.minor.patch triple', () => {
|
|
138
|
+
assert.deepEqual(parseSemver('2.1.220'), { major: 2, minor: 1, patch: 220 });
|
|
139
|
+
assert.deepEqual(parseSemver('claude 2.1.219 (win)'), { major: 2, minor: 1, patch: 219 });
|
|
140
|
+
assert.equal(parseSemver('unknown'), null);
|
|
141
|
+
assert.equal(parseSemver(''), null);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
test('launcher preflight evaluates probes and blocks incompatible pairs', () => {
|
|
145
|
+
const blocked = evaluateLauncherVersionCompatibility({
|
|
146
|
+
cli: { path: 'cli', versionText: '2.1.220' },
|
|
147
|
+
desktop: { path: 'desktop', versionText: '1.0.0' },
|
|
148
|
+
});
|
|
149
|
+
assert.equal(blocked.class, 'major-drift');
|
|
150
|
+
assert.equal(blocked.action, 'block');
|
|
151
|
+
assert.equal(shouldBlockLaunch(blocked), true);
|
|
152
|
+
const message = formatCompatibilityPreflightFailure(blocked);
|
|
153
|
+
assert.match(message, /version compatibility/i);
|
|
154
|
+
assert.match(message, /major drift/i);
|
|
155
|
+
|
|
156
|
+
const allowed = evaluateLauncherVersionCompatibility({
|
|
157
|
+
cli: { path: 'cli', versionText: '2.1.220' },
|
|
158
|
+
desktop: { path: 'desktop', versionText: '2.1.220' },
|
|
159
|
+
});
|
|
160
|
+
assert.equal(allowed.action, 'pass');
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test('live CLI version diagnostic records a real probe when CLAUDE_CLI_PATH is set', () => {
|
|
164
|
+
const cliPath = process.env.CLAUDE_CLI_PATH;
|
|
165
|
+
if (!cliPath || !existsSync(cliPath)) {
|
|
166
|
+
// Policy matrix above is the unit evidence. Live readback is optional and
|
|
167
|
+
// activated by CLAUDE_CLI_PATH so the suite stays free of host-private paths.
|
|
168
|
+
const missing = classifyVersionCompatibility({
|
|
169
|
+
cli: { path: null, versionText: null, errorCode: 'missing' },
|
|
170
|
+
desktop: { path: null, versionText: null, errorCode: 'missing' },
|
|
171
|
+
});
|
|
172
|
+
assert.equal(missing.class, 'missing-binary');
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
const probe = spawnSync(cliPath, ['--version'], {
|
|
176
|
+
encoding: 'utf8',
|
|
177
|
+
timeout: 15_000,
|
|
178
|
+
});
|
|
179
|
+
const versionText = `${probe.stdout || ''}${probe.stderr || ''}`.trim();
|
|
180
|
+
assert.equal(probe.error, undefined);
|
|
181
|
+
assert.ok(versionText.length > 0, 'claude --version produced empty output');
|
|
182
|
+
const parsed = parseSemver(versionText);
|
|
183
|
+
assert.ok(parsed, `expected semver in: ${versionText}`);
|
|
184
|
+
|
|
185
|
+
// Self-pair: equal pass against the same live CLI text (desktop diagnostic-only).
|
|
186
|
+
const result = classifyVersionCompatibility({
|
|
187
|
+
cli: { path: cliPath, versionText },
|
|
188
|
+
desktop: { path: cliPath, versionText },
|
|
189
|
+
});
|
|
190
|
+
assert.equal(result.class, 'equal');
|
|
191
|
+
assert.equal(result.action, 'pass');
|
|
192
|
+
assert.equal(result.policyVersion, COMPATIBILITY_POLICY_VERSION);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
test('package ships version-compatibility module and test paths', () => {
|
|
196
|
+
const allPaths = [
|
|
197
|
+
join(PACKAGE_ROOT, 'scripts/profile-isolation-launchers/version-compatibility.mjs'),
|
|
198
|
+
join(PACKAGE_ROOT, 'scripts/profile-isolation-launchers/tests/version-compatibility.test.mjs'),
|
|
199
|
+
join(PACKAGE_ROOT, 'scripts/profile-isolation-launchers/launcher-runtime.mjs'),
|
|
200
|
+
];
|
|
201
|
+
for (const eachPath of allPaths) {
|
|
202
|
+
assert.ok(existsSync(eachPath), `missing ${eachPath}`);
|
|
203
|
+
}
|
|
204
|
+
const runtimeSource = readFileSync(
|
|
205
|
+
join(PACKAGE_ROOT, 'scripts/profile-isolation-launchers/launcher-runtime.mjs'),
|
|
206
|
+
'utf8',
|
|
207
|
+
);
|
|
208
|
+
assert.match(runtimeSource, /version-compatibility\.mjs/);
|
|
209
|
+
assert.match(runtimeSource, /evaluateLauncherVersionCompatibility/);
|
|
210
|
+
});
|