claude-dev-env 1.38.1 → 1.40.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 +10 -36
- package/_shared/pr-loop/audit-reply-template.md +147 -0
- package/_shared/pr-loop/fix-protocol.md +25 -4
- package/_shared/pr-loop/gh-payloads.md +37 -50
- package/_shared/pr-loop/scripts/code_rules_gate.py +0 -60
- package/_shared/pr-loop/scripts/config/post_audit_thread_constants.py +199 -0
- package/_shared/pr-loop/scripts/config/reviews_disabled_constants.py +8 -0
- package/_shared/pr-loop/scripts/post_audit_thread.py +1242 -0
- package/_shared/pr-loop/scripts/preflight.py +129 -2
- package/_shared/pr-loop/scripts/reviews_disabled.py +59 -0
- package/_shared/pr-loop/scripts/tests/test_code_rules_gate.py +0 -19
- package/_shared/pr-loop/scripts/tests/test_post_audit_thread.py +1116 -0
- package/_shared/pr-loop/scripts/tests/test_post_audit_thread_constants.py +127 -0
- package/_shared/pr-loop/scripts/tests/test_preflight.py +41 -0
- package/_shared/pr-loop/scripts/tests/test_reviews_disabled.py +36 -0
- package/_shared/pr-loop/state-schema.md +1 -1
- package/agents/clean-coder.md +2 -2
- package/agents/pr-description-writer.md +150 -52
- package/bin/install.mjs +6 -7
- package/bin/install.test.mjs +8 -0
- package/commands/doc-gist.md +16 -0
- package/commands/plan.md +0 -2
- package/commands/review-plan.md +1 -1
- package/docs/CODE_RULES.md +122 -2
- package/docs/PR_DESCRIPTION_GUIDE.md +127 -64
- package/hooks/blocking/bot_mention_comment_blocker.py +75 -0
- package/hooks/blocking/code_rules_enforcer.py +1143 -129
- package/hooks/blocking/convergence_gate_blocker.py +130 -0
- package/hooks/blocking/destructive_command_blocker.py +74 -0
- package/hooks/blocking/gh_body_arg_blocker.py +30 -0
- package/hooks/blocking/md_to_html_blocker.py +119 -0
- package/hooks/blocking/pr_description_enforcer.py +57 -22
- package/hooks/blocking/test_bot_mention_comment_blocker.py +131 -0
- package/hooks/blocking/test_code_rules_enforcer.py +21 -0
- package/hooks/blocking/test_code_rules_enforcer_any_exempt_files.py +70 -0
- package/hooks/blocking/test_code_rules_enforcer_any_imports_and_cast.py +92 -0
- package/hooks/blocking/test_code_rules_enforcer_banned_import_alias.py +143 -0
- package/hooks/blocking/test_code_rules_enforcer_banned_prefixes.py +152 -0
- package/hooks/blocking/test_code_rules_enforcer_bare_except.py +120 -0
- package/hooks/blocking/test_code_rules_enforcer_boundary_types.py +175 -0
- package/hooks/blocking/test_code_rules_enforcer_cap_meta.py +0 -1
- package/hooks/blocking/test_code_rules_enforcer_collection_prefix.py +50 -0
- package/hooks/blocking/test_code_rules_enforcer_docstring_format.py +255 -0
- package/hooks/blocking/test_code_rules_enforcer_inline_tuple_string_magic.py +130 -0
- package/hooks/blocking/test_code_rules_enforcer_stub_implementations.py +141 -0
- package/hooks/blocking/test_code_rules_enforcer_test_branching.py +143 -0
- package/hooks/blocking/test_code_rules_enforcer_thin_wrapper_files.py +169 -0
- package/hooks/blocking/test_code_rules_enforcer_todo_markers.py +99 -0
- package/hooks/blocking/test_code_rules_enforcer_typed_dict_pairs.py +141 -0
- package/hooks/blocking/test_convergence_gate_blocker.py +63 -0
- package/hooks/blocking/test_destructive_command_blocker.py +146 -0
- package/hooks/blocking/test_destructive_command_blocker_no_verify.py +102 -0
- package/hooks/blocking/test_gh_body_arg_blocker.py +45 -0
- package/hooks/blocking/test_md_to_html_blocker.py +317 -0
- package/hooks/blocking/test_pr_description_enforcer.py +69 -8
- package/hooks/config/any_type_config.py +7 -0
- package/hooks/config/banned_identifiers_constants.py +11 -0
- package/hooks/config/blocking_check_limits.py +38 -0
- package/hooks/config/bot_mention_comment_blocker_constants.py +20 -0
- package/hooks/config/code_rules_enforcer_constants.py +53 -0
- package/hooks/config/convergence_branch_constants.py +9 -0
- package/hooks/config/doc_gist_auto_publish_constants.py +18 -0
- package/hooks/config/html_companion_constants.py +20 -0
- package/hooks/config/inline_tuple_string_magic_constants.py +22 -0
- package/hooks/config/pr_description_enforcer_constants.py +14 -0
- package/hooks/config/test_banned_identifiers_constants.py +17 -0
- package/hooks/hooks.json +28 -20
- package/hooks/pyproject.toml +69 -0
- package/hooks/validators/mypy_integration.py +47 -1
- package/hooks/validators/run_all_validators.py +3 -3
- package/hooks/validators/test_mypy_integration.py +50 -1
- package/hooks/workflow/doc_gist_auto_publish.py +144 -0
- package/hooks/workflow/md_to_html_companion.py +365 -0
- package/hooks/workflow/test_doc_gist_auto_publish.py +117 -0
- package/hooks/workflow/test_md_to_html_companion.py +452 -0
- package/package.json +1 -1
- package/rules/gh-body-file.md +2 -0
- package/scripts/Install-SweepEmptyDirs.ps1 +111 -0
- package/scripts/check.ps1 +106 -0
- package/scripts/config/timing.py +11 -0
- package/scripts/sweep_empty_dirs.py +138 -0
- package/scripts/sync_to_cursor/rules.py +1 -1
- package/scripts/test_sweep_empty_dirs.py +183 -0
- package/skills/_shared/pr-loop/prompts/pr-consistency-audit.xml +323 -0
- package/skills/_shared/pr-loop/scripts/_cli_utils.py +22 -0
- package/skills/_shared/pr-loop/scripts/_path_resolver.py +165 -0
- package/skills/_shared/pr-loop/scripts/_xml_utils.py +20 -0
- package/skills/_shared/pr-loop/scripts/build_audit_prompt.py +182 -0
- package/skills/_shared/pr-loop/scripts/build_fix_prompt.py +185 -0
- package/skills/_shared/pr-loop/scripts/config/__init__.py +0 -0
- package/skills/_shared/pr-loop/scripts/config/path_resolver_constants.py +78 -0
- package/skills/_shared/pr-loop/scripts/init_loop_state.py +135 -0
- package/skills/_shared/pr-loop/scripts/teardown_worktrees.py +175 -0
- package/skills/_shared/pr-loop/scripts/write_audit_outcomes.py +182 -0
- package/skills/_shared/pr-loop/scripts/write_fix_outcomes.py +206 -0
- package/skills/bugteam/CONSTRAINTS.md +21 -22
- package/skills/bugteam/EXAMPLES.md +3 -3
- package/skills/bugteam/PROMPTS.md +227 -67
- package/skills/bugteam/SKILL.md +132 -455
- package/skills/bugteam/reference/README.md +1 -1
- package/skills/bugteam/reference/audit-and-teammates.md +112 -39
- package/skills/bugteam/reference/audit-contract.md +4 -22
- package/skills/bugteam/reference/copilot-gap-analysis.md +8 -5
- package/skills/bugteam/reference/design-rationale.md +2 -2
- package/skills/bugteam/reference/github-pr-reviews.md +50 -57
- package/skills/bugteam/reference/obstacles/audit-assign-ids.md +13 -0
- package/skills/bugteam/reference/obstacles/audit-capture-excerpts.md +13 -0
- package/skills/bugteam/reference/obstacles/audit-walk-categories.md +13 -0
- package/skills/bugteam/reference/obstacles/audit-write-xml.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-append-summary.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-apply-fixes.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-git-add-commit.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-git-push.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-post-reply.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-publish-summary.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-py-compile.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-read-files.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-resolve-thread.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-test-suite.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-violation-count.md +13 -0
- package/skills/bugteam/reference/obstacles/fix-write-xml.md +13 -0
- package/skills/bugteam/reference/team-setup.md +111 -9
- package/skills/bugteam/reference/teardown-publish-permissions.md +39 -8
- package/skills/bugteam/scripts/README.md +60 -0
- package/skills/bugteam/scripts/_claude_permissions_common.py +358 -0
- package/skills/bugteam/scripts/bugteam_code_rules_gate.py +976 -0
- package/skills/bugteam/scripts/bugteam_fix_hookspath.py +375 -0
- package/skills/bugteam/scripts/bugteam_preflight.py +328 -0
- package/skills/bugteam/scripts/config/bugteam_code_rules_gate_constants.py +25 -0
- package/skills/bugteam/scripts/config/bugteam_fix_hookspath_constants.py +26 -0
- package/skills/bugteam/scripts/config/bugteam_preflight_constants.py +35 -0
- package/skills/bugteam/scripts/config/claude_permissions_common_constants.py +20 -0
- package/skills/bugteam/scripts/config/probe_code_rules_enforcer_check_constants.py +12 -0
- package/skills/bugteam/scripts/config/windows_safe_rmtree_constants.py +7 -0
- package/skills/bugteam/scripts/grant_project_claude_permissions.py +175 -0
- package/skills/bugteam/scripts/probe_code_rules_enforcer_check.py +107 -0
- package/skills/bugteam/scripts/revoke_project_claude_permissions.py +220 -0
- package/skills/bugteam/scripts/test__claude_permissions_common.py +112 -0
- package/skills/bugteam/scripts/test_bugteam_code_rules_gate.py +400 -0
- package/skills/bugteam/scripts/test_bugteam_fix_hookspath.py +384 -0
- package/skills/bugteam/scripts/test_bugteam_preflight.py +309 -0
- package/skills/bugteam/scripts/test_claude_permissions_common.py +195 -0
- package/skills/bugteam/scripts/test_grant_project_claude_permissions.py +55 -0
- package/skills/bugteam/scripts/test_probe_code_rules_enforcer_check.py +76 -0
- package/skills/bugteam/scripts/test_revoke_project_claude_permissions.py +55 -0
- package/skills/bugteam/scripts/test_windows_safe_rmtree.py +108 -0
- package/skills/bugteam/scripts/windows_safe_rmtree.py +100 -0
- package/skills/bugteam/test_skill_additions.py +1 -11
- package/skills/code/SKILL.md +176 -0
- package/skills/copilot-review/SKILL.md +16 -0
- package/skills/doc-gist/SKILL.md +99 -0
- package/skills/doc-gist/references/examples/01-exploration-code-approaches.html +453 -0
- package/skills/doc-gist/references/examples/02-exploration-visual-designs.html +515 -0
- package/skills/doc-gist/references/examples/03-code-review-pr.html +638 -0
- package/skills/doc-gist/references/examples/04-code-understanding.html +491 -0
- package/skills/doc-gist/references/examples/05-design-system.html +629 -0
- package/skills/doc-gist/references/examples/06-component-variants.html +605 -0
- package/skills/doc-gist/references/examples/07-prototype-animation.html +455 -0
- package/skills/doc-gist/references/examples/08-prototype-interaction.html +396 -0
- package/skills/doc-gist/references/examples/09-slide-deck.html +592 -0
- package/skills/doc-gist/references/examples/10-svg-illustrations.html +492 -0
- package/skills/doc-gist/references/examples/11-status-report.html +528 -0
- package/skills/doc-gist/references/examples/12-incident-report.html +596 -0
- package/skills/doc-gist/references/examples/13-flowchart-diagram.html +395 -0
- package/skills/doc-gist/references/examples/14-research-feature-explainer.html +381 -0
- package/skills/doc-gist/references/examples/15-research-concept-explainer.html +368 -0
- package/skills/doc-gist/references/examples/16-implementation-plan.html +702 -0
- package/skills/doc-gist/references/examples/17-pr-writeup.html +595 -0
- package/skills/doc-gist/references/examples/18-editor-triage-board.html +573 -0
- package/skills/doc-gist/references/examples/19-editor-feature-flags.html +663 -0
- package/skills/doc-gist/references/examples/20-editor-prompt-tuner.html +722 -0
- package/skills/doc-gist/references/examples/README.md +5 -0
- package/skills/doc-gist/scripts/config/__init__.py +0 -0
- package/skills/doc-gist/scripts/config/gist_upload_constants.py +16 -0
- package/skills/doc-gist/scripts/gist_upload.py +177 -0
- package/skills/doc-gist/scripts/test_gist_upload.py +51 -0
- package/skills/findbugs/SKILL.md +96 -2
- package/skills/monitor-open-prs/SKILL.md +14 -32
- package/skills/monitor-open-prs/test_skill_contract.py +0 -11
- package/skills/pr-consistency-audit/SKILL.md +112 -0
- package/skills/pr-consistency-audit/reference/detection-rules.md +96 -0
- package/skills/pr-consistency-audit/reference/illustrations.md +78 -0
- package/skills/pr-converge/SKILL.md +229 -23
- package/skills/pr-converge/config/__init__.py +0 -0
- package/skills/pr-converge/config/constants.py +63 -0
- package/skills/pr-converge/reference/convergence-gates.md +138 -44
- package/skills/pr-converge/reference/examples.md +43 -11
- package/skills/pr-converge/reference/fix-protocol.md +6 -5
- package/skills/pr-converge/reference/ground-rules.md +5 -3
- package/skills/pr-converge/reference/multi-pr-orchestration.md +44 -19
- package/skills/pr-converge/reference/obstacles/fix-post-replies.md +13 -0
- package/skills/pr-converge/reference/obstacles/fix-publish-summary.md +13 -0
- package/skills/pr-converge/reference/obstacles/fix-push.md +13 -0
- package/skills/pr-converge/reference/obstacles/fix-read-filelines.md +13 -0
- package/skills/pr-converge/reference/obstacles/fix-reset-state.md +13 -0
- package/skills/pr-converge/reference/obstacles/fix-resolve-threads.md +13 -0
- package/skills/pr-converge/reference/obstacles/fix-spawn-clean-coder.md +13 -0
- package/skills/pr-converge/reference/obstacles/fix-stage-commit.md +13 -0
- package/skills/pr-converge/reference/obstacles/fix-trigger-bugbot.md +13 -0
- package/skills/pr-converge/reference/obstacles/fix-write-test.md +13 -0
- package/skills/pr-converge/reference/per-tick.md +107 -31
- package/skills/pr-converge/reference/state-schema.md +22 -1
- package/skills/pr-converge/reference/stop-conditions.md +9 -7
- package/skills/pr-converge/scripts/README.md +34 -46
- package/skills/pr-converge/scripts/check_bugbot_ci.py +279 -0
- package/skills/pr-converge/scripts/check_convergence.py +497 -0
- package/skills/pr-converge/scripts/check_pending_reviews.py +154 -0
- package/skills/pr-converge/scripts/config/pr_converge_constants.py +118 -0
- package/skills/pr-converge/scripts/fetch_copilot_reviews.py +134 -0
- package/skills/pr-converge/scripts/post_fix_reply.py +168 -0
- package/skills/pr-converge/scripts/test_check_bugbot_ci.py +312 -0
- package/skills/pr-converge/workflows/schedule-wakeup-loop.md +5 -12
- package/skills/qbug/SKILL.md +157 -27
- package/skills/session-log/SKILL.md +216 -114
- package/skills/session-tidy/SKILL.md +1 -1
- package/skills/skill-builder/SKILL.md +138 -56
- package/skills/skill-builder/references/delegation-map.md +72 -113
- package/skills/skill-builder/references/progressive-disclosure.md +122 -0
- package/skills/skill-builder/references/self-audit-checklist.md +92 -0
- package/skills/skill-builder/references/skill-types.md +228 -0
- package/skills/skill-builder/references/thariq-x-post-skills.json +33 -0
- package/skills/skill-builder/templates/gap-analysis.md +15 -8
- package/skills/skill-builder/workflows/improve-skill.md +86 -57
- package/skills/skill-builder/workflows/new-skill.md +80 -168
- package/skills/skill-builder/workflows/polish-skill.md +78 -54
- package/skills/structure-prompt/SKILL.md +50 -0
- package/skills/structure-prompt/reference/adversarial-tuning.md +62 -0
- package/skills/structure-prompt/reference/block-classification.md +27 -0
- package/skills/structure-prompt/reference/canonical-case.md +48 -0
- package/skills/structure-prompt/reference/citation-depth.md +70 -0
- package/skills/structure-prompt/reference/cleanup.md +33 -0
- package/skills/structure-prompt/reference/constraints.md +33 -0
- package/skills/structure-prompt/reference/directives.md +37 -0
- package/skills/structure-prompt/reference/examples.md +72 -0
- package/skills/structure-prompt/reference/instantiation.md +51 -0
- package/skills/structure-prompt/reference/output-contract.md +72 -0
- package/skills/structure-prompt/reference/per-category.md +23 -0
- package/skills/structure-prompt/reference/persona.md +38 -0
- package/skills/structure-prompt/reference/research.md +33 -0
- package/skills/structure-prompt/reference/structure.md +28 -0
- package/agents/code-standards-agent.md +0 -93
- package/agents/groq-coder.md +0 -113
- package/agents/plan-executor.md +0 -226
- package/agents/project-docs-analyzer.md +0 -53
- package/agents/project-structure-organizer-agent.md +0 -72
- package/agents/skill-to-agent-converter.md +0 -370
- package/agents/skill-writer-agent.md +0 -470
- package/agents/user-docs-writer.md +0 -67
- package/agents/workflow-visual-documenter.md +0 -82
- package/commands/readability-review.md +0 -20
- package/hooks/mypy.ini +0 -2
- package/hooks/notification/attention_needed_notify.py +0 -71
- package/hooks/notification/claude_notification_handler.py +0 -67
- package/hooks/notification/notification_utils.py +0 -267
- package/hooks/notification/subagent_complete_notify.py +0 -381
- package/hooks/notification/test_attention_needed_notify.py +0 -47
- package/hooks/notification/test_claude_notification_handler.py +0 -54
- package/hooks/notification/test_notification_utils.py +0 -91
- package/hooks/notification/test_subagent_complete_notify.py +0 -79
- package/scripts/config/groq_bugteam_config.py +0 -230
- package/scripts/config/test_groq_bugteam_config.py +0 -83
- package/scripts/config/test_spec_implementer_prompt.py +0 -32
- package/scripts/groq_bugteam.README.md +0 -131
- package/scripts/groq_bugteam.py +0 -647
- package/scripts/groq_bugteam_dotenv.py +0 -40
- package/scripts/groq_bugteam_spec.py +0 -226
- package/scripts/test_groq_bugteam.py +0 -529
- package/scripts/test_groq_bugteam_apply_fix_from_spec.py +0 -426
- package/scripts/test_groq_bugteam_dotenv.py +0 -66
- package/scripts/test_groq_bugteam_spec.py +0 -338
- package/skills/bugteam/SKILL_EVALS.md +0 -309
- package/skills/dream/SKILL.md +0 -118
- package/skills/ingest/SKILL.md +0 -40
- package/skills/npm-creator/SKILL.md +0 -187
- package/skills/readability-review/SKILL.md +0 -127
- package/skills/resume-review/SKILL.md +0 -261
- package/skills/rule-audit/SKILL.md +0 -307
- package/skills/rule-creator/SKILL.md +0 -150
- package/skills/searching-obsidian-vault/SKILL.md +0 -131
- package/skills/skill-writer/REFERENCE.md +0 -284
- package/skills/skill-writer/SKILL.md +0 -222
- package/skills/tdd-team/SKILL.md +0 -128
|
@@ -0,0 +1,663 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>Birchline — flags.production.json</title>
|
|
7
|
+
<style>
|
|
8
|
+
:root {
|
|
9
|
+
--ivory: #FAF9F5;
|
|
10
|
+
--slate: #141413;
|
|
11
|
+
--clay: #D97757;
|
|
12
|
+
--clay-d: #B85C3E;
|
|
13
|
+
--oat: #E3DACC;
|
|
14
|
+
--olive: #788C5D;
|
|
15
|
+
--gray-50: #F0EEE6;
|
|
16
|
+
--gray-200: #D1CFC5;
|
|
17
|
+
--gray-500: #87867F;
|
|
18
|
+
--gray-800: #3D3D3A;
|
|
19
|
+
--white: #ffffff;
|
|
20
|
+
--serif: ui-serif, Georgia, "Times New Roman", serif;
|
|
21
|
+
--sans: system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
22
|
+
--mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
|
|
23
|
+
}
|
|
24
|
+
* { box-sizing: border-box; }
|
|
25
|
+
html, body {
|
|
26
|
+
margin: 0;
|
|
27
|
+
background: var(--ivory);
|
|
28
|
+
color: var(--slate);
|
|
29
|
+
font-family: var(--sans);
|
|
30
|
+
font-size: 14px;
|
|
31
|
+
line-height: 1.5;
|
|
32
|
+
}
|
|
33
|
+
.wrap {
|
|
34
|
+
max-width: 1080px;
|
|
35
|
+
margin: 0 auto;
|
|
36
|
+
padding: 48px 32px 64px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* ---------- header ---------- */
|
|
40
|
+
header { margin-bottom: 28px; }
|
|
41
|
+
.eyebrow {
|
|
42
|
+
font-family: var(--mono);
|
|
43
|
+
font-size: 11px;
|
|
44
|
+
letter-spacing: 0.08em;
|
|
45
|
+
text-transform: uppercase;
|
|
46
|
+
color: var(--gray-500);
|
|
47
|
+
}
|
|
48
|
+
h1 {
|
|
49
|
+
font-family: var(--serif);
|
|
50
|
+
font-weight: 500;
|
|
51
|
+
font-size: 30px;
|
|
52
|
+
letter-spacing: -0.01em;
|
|
53
|
+
margin: 6px 0 4px;
|
|
54
|
+
}
|
|
55
|
+
.sub {
|
|
56
|
+
color: var(--gray-500);
|
|
57
|
+
max-width: 600px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* ---------- layout ---------- */
|
|
61
|
+
.layout {
|
|
62
|
+
display: grid;
|
|
63
|
+
grid-template-columns: 1fr 320px;
|
|
64
|
+
gap: 24px;
|
|
65
|
+
align-items: start;
|
|
66
|
+
}
|
|
67
|
+
@media (max-width: 880px) {
|
|
68
|
+
.layout { grid-template-columns: 1fr; }
|
|
69
|
+
.sidebar { position: static !important; }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* ---------- warning banner ---------- */
|
|
73
|
+
.banner {
|
|
74
|
+
grid-column: 1 / -1;
|
|
75
|
+
display: none;
|
|
76
|
+
align-items: baseline;
|
|
77
|
+
gap: 8px;
|
|
78
|
+
padding: 10px 14px;
|
|
79
|
+
border: 1.5px solid #E8C2AE;
|
|
80
|
+
background: #F8E9E0;
|
|
81
|
+
color: var(--clay-d);
|
|
82
|
+
border-radius: 10px;
|
|
83
|
+
font-size: 13px;
|
|
84
|
+
}
|
|
85
|
+
.banner.show { display: flex; }
|
|
86
|
+
.banner .glyph { font-size: 13px; line-height: 1; transform: translateY(1px); }
|
|
87
|
+
|
|
88
|
+
/* ---------- groups / panels ---------- */
|
|
89
|
+
.form-col { display: flex; flex-direction: column; gap: 16px; }
|
|
90
|
+
.group {
|
|
91
|
+
background: var(--white);
|
|
92
|
+
border: 1.5px solid var(--gray-200);
|
|
93
|
+
border-radius: 12px;
|
|
94
|
+
overflow: hidden;
|
|
95
|
+
}
|
|
96
|
+
.group-head {
|
|
97
|
+
font-family: var(--mono);
|
|
98
|
+
font-size: 11px;
|
|
99
|
+
letter-spacing: 0.08em;
|
|
100
|
+
text-transform: uppercase;
|
|
101
|
+
color: var(--gray-500);
|
|
102
|
+
padding: 12px 18px 11px;
|
|
103
|
+
border-bottom: 1.5px solid var(--gray-50);
|
|
104
|
+
display: flex;
|
|
105
|
+
justify-content: space-between;
|
|
106
|
+
gap: 12px;
|
|
107
|
+
}
|
|
108
|
+
.group-head .name { color: var(--gray-800); }
|
|
109
|
+
.group-head .meta { letter-spacing: 0.04em; }
|
|
110
|
+
|
|
111
|
+
/* ---------- flag rows ---------- */
|
|
112
|
+
.flag {
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: flex-start;
|
|
115
|
+
gap: 16px;
|
|
116
|
+
padding: 14px 18px;
|
|
117
|
+
border-bottom: 1px solid var(--gray-50);
|
|
118
|
+
border-left: 3px solid transparent;
|
|
119
|
+
transition: border-left-color 140ms ease, background 140ms ease;
|
|
120
|
+
}
|
|
121
|
+
.flag:last-child { border-bottom: none; }
|
|
122
|
+
.flag.warn {
|
|
123
|
+
border-left-color: var(--clay);
|
|
124
|
+
background: #FBF3EE;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.flag-info { flex: 1; min-width: 0; }
|
|
128
|
+
.flag-key {
|
|
129
|
+
font-family: var(--mono);
|
|
130
|
+
font-size: 13px;
|
|
131
|
+
color: var(--gray-800);
|
|
132
|
+
display: flex;
|
|
133
|
+
align-items: center;
|
|
134
|
+
gap: 7px;
|
|
135
|
+
flex-wrap: wrap;
|
|
136
|
+
}
|
|
137
|
+
.dot {
|
|
138
|
+
display: none;
|
|
139
|
+
width: 6px;
|
|
140
|
+
height: 6px;
|
|
141
|
+
border-radius: 50%;
|
|
142
|
+
background: var(--clay);
|
|
143
|
+
flex: none;
|
|
144
|
+
}
|
|
145
|
+
.flag.changed .dot { display: inline-block; }
|
|
146
|
+
.rollout {
|
|
147
|
+
font-family: var(--mono);
|
|
148
|
+
font-size: 10px;
|
|
149
|
+
letter-spacing: 0.03em;
|
|
150
|
+
color: var(--gray-500);
|
|
151
|
+
background: var(--gray-50);
|
|
152
|
+
border: 1px solid var(--gray-200);
|
|
153
|
+
border-radius: 999px;
|
|
154
|
+
padding: 1px 7px 2px;
|
|
155
|
+
}
|
|
156
|
+
.flag-desc {
|
|
157
|
+
color: var(--gray-500);
|
|
158
|
+
font-size: 12.5px;
|
|
159
|
+
margin-top: 2px;
|
|
160
|
+
}
|
|
161
|
+
.req-chip {
|
|
162
|
+
display: inline-flex;
|
|
163
|
+
align-items: baseline;
|
|
164
|
+
gap: 5px;
|
|
165
|
+
margin-top: 7px;
|
|
166
|
+
font-family: var(--mono);
|
|
167
|
+
font-size: 11px;
|
|
168
|
+
color: var(--gray-500);
|
|
169
|
+
background: var(--gray-50);
|
|
170
|
+
border: 1px solid var(--gray-200);
|
|
171
|
+
border-radius: 999px;
|
|
172
|
+
padding: 2px 9px 3px;
|
|
173
|
+
}
|
|
174
|
+
.req-chip .warn-glyph { display: none; }
|
|
175
|
+
.flag.warn .req-chip {
|
|
176
|
+
color: var(--clay-d);
|
|
177
|
+
background: #F8E1D5;
|
|
178
|
+
border-color: #E8C2AE;
|
|
179
|
+
}
|
|
180
|
+
.flag.warn .req-chip .warn-glyph { display: inline; }
|
|
181
|
+
|
|
182
|
+
/* ---------- toggle switch ---------- */
|
|
183
|
+
.toggle {
|
|
184
|
+
position: relative;
|
|
185
|
+
flex: none;
|
|
186
|
+
width: 38px;
|
|
187
|
+
height: 22px;
|
|
188
|
+
margin-top: 1px;
|
|
189
|
+
}
|
|
190
|
+
.toggle input {
|
|
191
|
+
position: absolute;
|
|
192
|
+
inset: 0;
|
|
193
|
+
width: 100%;
|
|
194
|
+
height: 100%;
|
|
195
|
+
margin: 0;
|
|
196
|
+
opacity: 0;
|
|
197
|
+
cursor: pointer;
|
|
198
|
+
}
|
|
199
|
+
.toggle .track {
|
|
200
|
+
position: absolute;
|
|
201
|
+
inset: 0;
|
|
202
|
+
background: var(--gray-200);
|
|
203
|
+
border-radius: 999px;
|
|
204
|
+
transition: background 160ms ease;
|
|
205
|
+
pointer-events: none;
|
|
206
|
+
}
|
|
207
|
+
.toggle .track::after {
|
|
208
|
+
content: "";
|
|
209
|
+
position: absolute;
|
|
210
|
+
top: 3px;
|
|
211
|
+
left: 3px;
|
|
212
|
+
width: 16px;
|
|
213
|
+
height: 16px;
|
|
214
|
+
border-radius: 50%;
|
|
215
|
+
background: var(--white);
|
|
216
|
+
box-shadow: 0 1px 2px rgba(20,20,19,0.18);
|
|
217
|
+
transition: transform 160ms ease;
|
|
218
|
+
}
|
|
219
|
+
.toggle input:checked + .track { background: var(--olive); }
|
|
220
|
+
.toggle input:checked + .track::after { transform: translateX(16px); }
|
|
221
|
+
.toggle input:focus-visible + .track {
|
|
222
|
+
outline: 2px solid var(--slate);
|
|
223
|
+
outline-offset: 2px;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* ---------- sidebar ---------- */
|
|
227
|
+
.sidebar {
|
|
228
|
+
position: sticky;
|
|
229
|
+
top: 24px;
|
|
230
|
+
background: var(--white);
|
|
231
|
+
border: 1.5px solid var(--gray-200);
|
|
232
|
+
border-radius: 12px;
|
|
233
|
+
padding: 18px;
|
|
234
|
+
display: flex;
|
|
235
|
+
flex-direction: column;
|
|
236
|
+
gap: 14px;
|
|
237
|
+
}
|
|
238
|
+
.side-label {
|
|
239
|
+
font-family: var(--mono);
|
|
240
|
+
font-size: 11px;
|
|
241
|
+
letter-spacing: 0.08em;
|
|
242
|
+
text-transform: uppercase;
|
|
243
|
+
color: var(--gray-500);
|
|
244
|
+
}
|
|
245
|
+
.side-count {
|
|
246
|
+
font-family: var(--serif);
|
|
247
|
+
font-weight: 500;
|
|
248
|
+
font-size: 19px;
|
|
249
|
+
letter-spacing: -0.01em;
|
|
250
|
+
}
|
|
251
|
+
.side-count .warn-n { color: var(--clay-d); }
|
|
252
|
+
.side-count .sep { color: var(--gray-200); margin: 0 4px; }
|
|
253
|
+
.diff {
|
|
254
|
+
margin: 0;
|
|
255
|
+
font-family: var(--mono);
|
|
256
|
+
font-size: 12px;
|
|
257
|
+
line-height: 1.7;
|
|
258
|
+
background: var(--gray-50);
|
|
259
|
+
border: 1px solid var(--gray-200);
|
|
260
|
+
border-radius: 8px;
|
|
261
|
+
padding: 12px 14px;
|
|
262
|
+
overflow-x: auto;
|
|
263
|
+
max-height: 320px;
|
|
264
|
+
overflow-y: auto;
|
|
265
|
+
white-space: pre;
|
|
266
|
+
}
|
|
267
|
+
.diff .minus { color: var(--gray-500); }
|
|
268
|
+
.diff .plus { color: var(--olive); }
|
|
269
|
+
.diff .empty { color: var(--gray-500); }
|
|
270
|
+
|
|
271
|
+
.btn {
|
|
272
|
+
display: block;
|
|
273
|
+
width: 100%;
|
|
274
|
+
border: none;
|
|
275
|
+
border-radius: 999px;
|
|
276
|
+
font-family: var(--mono);
|
|
277
|
+
font-size: 12px;
|
|
278
|
+
padding: 9px 16px;
|
|
279
|
+
cursor: pointer;
|
|
280
|
+
text-align: center;
|
|
281
|
+
transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
|
|
282
|
+
}
|
|
283
|
+
.btn.primary {
|
|
284
|
+
background: var(--slate);
|
|
285
|
+
color: var(--ivory);
|
|
286
|
+
}
|
|
287
|
+
.btn.primary:hover:not(:disabled) { background: var(--gray-800); }
|
|
288
|
+
.btn.primary:disabled {
|
|
289
|
+
background: var(--gray-200);
|
|
290
|
+
color: var(--gray-500);
|
|
291
|
+
cursor: not-allowed;
|
|
292
|
+
}
|
|
293
|
+
.btn.primary.copied { background: var(--olive); }
|
|
294
|
+
.btn.ghost {
|
|
295
|
+
background: transparent;
|
|
296
|
+
color: var(--gray-800);
|
|
297
|
+
border: 1.5px solid var(--gray-200);
|
|
298
|
+
}
|
|
299
|
+
.btn.ghost:hover { border-color: var(--gray-500); }
|
|
300
|
+
.btn.ghost.copied { border-color: var(--olive); color: var(--olive); }
|
|
301
|
+
.btn-stack { display: flex; flex-direction: column; gap: 8px; }
|
|
302
|
+
</style>
|
|
303
|
+
</head>
|
|
304
|
+
<body>
|
|
305
|
+
<div class="wrap">
|
|
306
|
+
|
|
307
|
+
<header>
|
|
308
|
+
<div class="eyebrow">Birchline / editor / feature-flags</div>
|
|
309
|
+
<h1>flags.production.json</h1>
|
|
310
|
+
<p class="sub">A form-based editor for the production feature-flag config.
|
|
311
|
+
Toggle flags, fix dependency warnings as they surface, then copy out
|
|
312
|
+
only the lines that changed.</p>
|
|
313
|
+
</header>
|
|
314
|
+
|
|
315
|
+
<div class="layout">
|
|
316
|
+
<div class="banner" id="banner">
|
|
317
|
+
<span class="glyph">⚠</span>
|
|
318
|
+
<span id="bannerText">1 flag is enabled without its prerequisite</span>
|
|
319
|
+
</div>
|
|
320
|
+
|
|
321
|
+
<div class="form-col" id="formCol"><!-- groups injected --></div>
|
|
322
|
+
|
|
323
|
+
<aside class="sidebar">
|
|
324
|
+
<div>
|
|
325
|
+
<div class="side-label">Pending changes</div>
|
|
326
|
+
<div class="side-count" id="sideCount">0 changed</div>
|
|
327
|
+
</div>
|
|
328
|
+
<pre class="diff" id="diff"><span class="empty">// no changes yet</span></pre>
|
|
329
|
+
<div class="btn-stack">
|
|
330
|
+
<button class="btn primary" id="copyDiff" disabled>Copy diff</button>
|
|
331
|
+
<button class="btn ghost" id="copyJson">Copy full JSON</button>
|
|
332
|
+
<button class="btn ghost" id="reset">Reset</button>
|
|
333
|
+
</div>
|
|
334
|
+
</aside>
|
|
335
|
+
</div>
|
|
336
|
+
|
|
337
|
+
</div>
|
|
338
|
+
|
|
339
|
+
<script>
|
|
340
|
+
"use strict";
|
|
341
|
+
|
|
342
|
+
// ---------------------------------------------------------------------------
|
|
343
|
+
// data — the production flag set, as it exists right now
|
|
344
|
+
// ---------------------------------------------------------------------------
|
|
345
|
+
|
|
346
|
+
const GROUPS = [
|
|
347
|
+
{
|
|
348
|
+
id: "onboarding",
|
|
349
|
+
label: "Onboarding",
|
|
350
|
+
flags: [
|
|
351
|
+
{ key: "onboarding.checklist_v2",
|
|
352
|
+
desc: "New three-step setup checklist replacing the modal tour.",
|
|
353
|
+
on: true },
|
|
354
|
+
{ key: "onboarding.invite_nudge",
|
|
355
|
+
desc: "Nudge owners to invite teammates after creating their first project.",
|
|
356
|
+
on: true },
|
|
357
|
+
{ key: "onboarding.workspace_templates",
|
|
358
|
+
desc: "Offer prebuilt workspace templates during signup.",
|
|
359
|
+
on: false, requires: "onboarding.checklist_v2" },
|
|
360
|
+
{ key: "onboarding.skip_email_verify",
|
|
361
|
+
desc: "Let SSO-domain users in before email verification completes.",
|
|
362
|
+
on: false }
|
|
363
|
+
]
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
id: "sync",
|
|
367
|
+
label: "Sync engine",
|
|
368
|
+
flags: [
|
|
369
|
+
{ key: "sync.delta_compression",
|
|
370
|
+
desc: "Send field-level deltas instead of full document snapshots.",
|
|
371
|
+
on: true },
|
|
372
|
+
{ key: "sync.offline_queue_v2",
|
|
373
|
+
desc: "Persist offline edits to IndexedDB and replay on reconnect.",
|
|
374
|
+
on: false, requires: "sync.delta_compression" },
|
|
375
|
+
{ key: "sync.presence_cursors",
|
|
376
|
+
desc: "Show live collaborator cursors in board and doc views.",
|
|
377
|
+
on: true },
|
|
378
|
+
{ key: "sync.conflict_banner",
|
|
379
|
+
desc: "Surface a merge banner instead of silently last-write-wins.",
|
|
380
|
+
on: false, requires: "sync.offline_queue_v2" },
|
|
381
|
+
{ key: "sync.binary_ws_frames",
|
|
382
|
+
desc: "Switch the realtime channel to binary WebSocket frames.",
|
|
383
|
+
on: false, rollout: 10 }
|
|
384
|
+
]
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
id: "billing",
|
|
388
|
+
label: "Billing",
|
|
389
|
+
flags: [
|
|
390
|
+
{ key: "billing.usage_meter",
|
|
391
|
+
desc: "Show per-seat usage meter on the workspace billing page.",
|
|
392
|
+
on: false },
|
|
393
|
+
{ key: "billing.annual_discount_banner",
|
|
394
|
+
desc: "Promote the annual-plan discount in the upgrade flow.",
|
|
395
|
+
on: true },
|
|
396
|
+
{ key: "billing.proration_preview",
|
|
397
|
+
desc: "Preview the prorated charge before confirming a plan change.",
|
|
398
|
+
on: false, requires: "billing.usage_meter" },
|
|
399
|
+
{ key: "billing.dunning_emails_v3",
|
|
400
|
+
desc: "Use the rewritten dunning sequence with a 14-day grace window.",
|
|
401
|
+
on: true, rollout: 25 }
|
|
402
|
+
]
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
id: "internal",
|
|
406
|
+
label: "Internal",
|
|
407
|
+
flags: [
|
|
408
|
+
{ key: "internal.shadow_traffic",
|
|
409
|
+
desc: "Mirror 1% of API traffic to the staging cluster for diffing.",
|
|
410
|
+
on: false },
|
|
411
|
+
{ key: "internal.query_tracing",
|
|
412
|
+
desc: "Attach OpenTelemetry spans to every Postgres query.",
|
|
413
|
+
on: true },
|
|
414
|
+
{ key: "internal.kill_switch_ui",
|
|
415
|
+
desc: "Expose the emergency kill-switch panel in the admin console.",
|
|
416
|
+
on: true, requires: "internal.query_tracing" }
|
|
417
|
+
]
|
|
418
|
+
}
|
|
419
|
+
];
|
|
420
|
+
|
|
421
|
+
// flat lookup, plus a frozen copy of initial state
|
|
422
|
+
const FLAGS = {};
|
|
423
|
+
const INITIAL = {};
|
|
424
|
+
GROUPS.forEach(g => g.flags.forEach(f => {
|
|
425
|
+
FLAGS[f.key] = f;
|
|
426
|
+
INITIAL[f.key] = f.on;
|
|
427
|
+
}));
|
|
428
|
+
|
|
429
|
+
// ---------------------------------------------------------------------------
|
|
430
|
+
// render the form once; state lives in the checkboxes
|
|
431
|
+
// ---------------------------------------------------------------------------
|
|
432
|
+
|
|
433
|
+
const formCol = document.getElementById("formCol");
|
|
434
|
+
const banner = document.getElementById("banner");
|
|
435
|
+
const bannerTxt = document.getElementById("bannerText");
|
|
436
|
+
const sideCount = document.getElementById("sideCount");
|
|
437
|
+
const diffEl = document.getElementById("diff");
|
|
438
|
+
const copyDiffBtn = document.getElementById("copyDiff");
|
|
439
|
+
const copyJsonBtn = document.getElementById("copyJson");
|
|
440
|
+
const resetBtn = document.getElementById("reset");
|
|
441
|
+
|
|
442
|
+
function esc(s) {
|
|
443
|
+
return String(s).replace(/[&<>"]/g, c =>
|
|
444
|
+
({ "&": "&", "<": "<", ">": ">", '"': """ }[c]));
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
function buildForm() {
|
|
448
|
+
formCol.innerHTML = "";
|
|
449
|
+
for (const g of GROUPS) {
|
|
450
|
+
const panel = document.createElement("section");
|
|
451
|
+
panel.className = "group";
|
|
452
|
+
panel.dataset.group = g.id;
|
|
453
|
+
|
|
454
|
+
const head = document.createElement("div");
|
|
455
|
+
head.className = "group-head";
|
|
456
|
+
head.innerHTML =
|
|
457
|
+
'<span class="name">' + esc(g.label) + '</span>' +
|
|
458
|
+
'<span class="meta" data-meta></span>';
|
|
459
|
+
panel.appendChild(head);
|
|
460
|
+
|
|
461
|
+
for (const f of g.flags) {
|
|
462
|
+
const row = document.createElement("div");
|
|
463
|
+
row.className = "flag";
|
|
464
|
+
row.dataset.key = f.key;
|
|
465
|
+
|
|
466
|
+
const rolloutBadge = (typeof f.rollout === "number")
|
|
467
|
+
? '<span class="rollout">' + f.rollout + '%</span>'
|
|
468
|
+
: "";
|
|
469
|
+
|
|
470
|
+
const reqChip = f.requires
|
|
471
|
+
? '<div class="req-chip"><span class="warn-glyph">⚠</span>' +
|
|
472
|
+
'<span>requires ' + esc(f.requires) + '</span></div>'
|
|
473
|
+
: "";
|
|
474
|
+
|
|
475
|
+
row.innerHTML =
|
|
476
|
+
'<label class="toggle">' +
|
|
477
|
+
'<input type="checkbox" data-key="' + esc(f.key) + '"' +
|
|
478
|
+
(f.on ? " checked" : "") +
|
|
479
|
+
' aria-label="' + esc(f.key) + '">' +
|
|
480
|
+
'<span class="track"></span>' +
|
|
481
|
+
'</label>' +
|
|
482
|
+
'<div class="flag-info">' +
|
|
483
|
+
'<div class="flag-key"><span class="dot"></span>' +
|
|
484
|
+
'<span>' + esc(f.key) + '</span>' + rolloutBadge +
|
|
485
|
+
'</div>' +
|
|
486
|
+
'<div class="flag-desc">' + esc(f.desc) + '</div>' +
|
|
487
|
+
reqChip +
|
|
488
|
+
'</div>';
|
|
489
|
+
|
|
490
|
+
panel.appendChild(row);
|
|
491
|
+
}
|
|
492
|
+
formCol.appendChild(panel);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// ---------------------------------------------------------------------------
|
|
497
|
+
// state helpers
|
|
498
|
+
// ---------------------------------------------------------------------------
|
|
499
|
+
|
|
500
|
+
function currentState() {
|
|
501
|
+
const state = {};
|
|
502
|
+
formCol.querySelectorAll("input[type=checkbox]").forEach(cb => {
|
|
503
|
+
state[cb.dataset.key] = cb.checked;
|
|
504
|
+
});
|
|
505
|
+
return state;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
function computeDiff(state) {
|
|
509
|
+
const lines = [];
|
|
510
|
+
for (const g of GROUPS) {
|
|
511
|
+
for (const f of g.flags) {
|
|
512
|
+
if (state[f.key] !== INITIAL[f.key]) {
|
|
513
|
+
lines.push({ key: f.key, from: INITIAL[f.key], to: state[f.key] });
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
return lines;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
function diffText(lines) {
|
|
521
|
+
return lines.map(l =>
|
|
522
|
+
'- "' + l.key + '": ' + l.from + '\n' +
|
|
523
|
+
'+ "' + l.key + '": ' + l.to
|
|
524
|
+
).join("\n");
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
function fullJson(state) {
|
|
528
|
+
// grouped, ordered, pretty-printed — what you'd actually paste into the file
|
|
529
|
+
let out = "{\n";
|
|
530
|
+
GROUPS.forEach((g, gi) => {
|
|
531
|
+
g.flags.forEach((f, fi) => {
|
|
532
|
+
const last = gi === GROUPS.length - 1 && fi === g.flags.length - 1;
|
|
533
|
+
out += ' "' + f.key + '": ' + state[f.key] + (last ? "" : ",") + "\n";
|
|
534
|
+
});
|
|
535
|
+
});
|
|
536
|
+
out += "}";
|
|
537
|
+
return out;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
// ---------------------------------------------------------------------------
|
|
541
|
+
// the live update pass
|
|
542
|
+
// ---------------------------------------------------------------------------
|
|
543
|
+
|
|
544
|
+
function update() {
|
|
545
|
+
const state = currentState();
|
|
546
|
+
let warnCount = 0;
|
|
547
|
+
|
|
548
|
+
// per-row decorations
|
|
549
|
+
for (const g of GROUPS) {
|
|
550
|
+
let onCount = 0;
|
|
551
|
+
for (const f of g.flags) {
|
|
552
|
+
const row = formCol.querySelector('.flag[data-key="' + CSS.escape(f.key) + '"]');
|
|
553
|
+
const on = state[f.key];
|
|
554
|
+
if (on) onCount++;
|
|
555
|
+
|
|
556
|
+
const changed = on !== INITIAL[f.key];
|
|
557
|
+
row.classList.toggle("changed", changed);
|
|
558
|
+
|
|
559
|
+
let warn = false;
|
|
560
|
+
if (f.requires && on && !state[f.requires]) warn = true;
|
|
561
|
+
row.classList.toggle("warn", warn);
|
|
562
|
+
if (warn) warnCount++;
|
|
563
|
+
}
|
|
564
|
+
const meta = formCol.querySelector(
|
|
565
|
+
'.group[data-group="' + g.id + '"] [data-meta]');
|
|
566
|
+
meta.textContent = g.flags.length + " flags, " + onCount + " on";
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
// diff + sidebar
|
|
570
|
+
const lines = computeDiff(state);
|
|
571
|
+
if (lines.length === 0) {
|
|
572
|
+
diffEl.innerHTML = '<span class="empty">// no changes yet</span>';
|
|
573
|
+
copyDiffBtn.disabled = true;
|
|
574
|
+
} else {
|
|
575
|
+
diffEl.innerHTML = lines.map(l =>
|
|
576
|
+
'<span class="minus">- "' + esc(l.key) + '": ' + l.from + '</span>\n' +
|
|
577
|
+
'<span class="plus">+ "' + esc(l.key) + '": ' + l.to + '</span>'
|
|
578
|
+
).join("\n");
|
|
579
|
+
copyDiffBtn.disabled = false;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
sideCount.innerHTML =
|
|
583
|
+
lines.length + " changed" +
|
|
584
|
+
'<span class="sep">·</span>' +
|
|
585
|
+
'<span class="' + (warnCount ? "warn-n" : "") + '">' +
|
|
586
|
+
warnCount + " warning" + (warnCount === 1 ? "" : "s") +
|
|
587
|
+
"</span>";
|
|
588
|
+
|
|
589
|
+
// banner
|
|
590
|
+
if (warnCount > 0) {
|
|
591
|
+
bannerTxt.textContent =
|
|
592
|
+
warnCount === 1
|
|
593
|
+
? "1 flag is enabled without its prerequisite"
|
|
594
|
+
: warnCount + " flags are enabled without their prerequisites";
|
|
595
|
+
banner.classList.add("show");
|
|
596
|
+
} else {
|
|
597
|
+
banner.classList.remove("show");
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
// ---------------------------------------------------------------------------
|
|
602
|
+
// clipboard + buttons
|
|
603
|
+
// ---------------------------------------------------------------------------
|
|
604
|
+
|
|
605
|
+
function flash(btn, label) {
|
|
606
|
+
const orig = btn.textContent;
|
|
607
|
+
btn.textContent = label;
|
|
608
|
+
btn.classList.add("copied");
|
|
609
|
+
btn.disabled = true;
|
|
610
|
+
setTimeout(() => {
|
|
611
|
+
btn.textContent = orig;
|
|
612
|
+
btn.classList.remove("copied");
|
|
613
|
+
btn.disabled = false;
|
|
614
|
+
update(); // restore disabled state on copyDiff if needed
|
|
615
|
+
}, 1200);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
function writeClipboard(text) {
|
|
619
|
+
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
620
|
+
return navigator.clipboard.writeText(text);
|
|
621
|
+
}
|
|
622
|
+
// fallback for file:// contexts without clipboard permission
|
|
623
|
+
const ta = document.createElement("textarea");
|
|
624
|
+
ta.value = text;
|
|
625
|
+
ta.style.position = "fixed";
|
|
626
|
+
ta.style.left = "-9999px";
|
|
627
|
+
document.body.appendChild(ta);
|
|
628
|
+
ta.select();
|
|
629
|
+
try { document.execCommand("copy"); } catch (e) { /* ignore */ }
|
|
630
|
+
document.body.removeChild(ta);
|
|
631
|
+
return Promise.resolve();
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
copyDiffBtn.addEventListener("click", () => {
|
|
635
|
+
const lines = computeDiff(currentState());
|
|
636
|
+
if (!lines.length) return;
|
|
637
|
+
writeClipboard(diffText(lines)).then(() => flash(copyDiffBtn, "Copied ✓"));
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
copyJsonBtn.addEventListener("click", () => {
|
|
641
|
+
writeClipboard(fullJson(currentState())).then(() => flash(copyJsonBtn, "Copied ✓"));
|
|
642
|
+
});
|
|
643
|
+
|
|
644
|
+
resetBtn.addEventListener("click", () => {
|
|
645
|
+
formCol.querySelectorAll("input[type=checkbox]").forEach(cb => {
|
|
646
|
+
cb.checked = INITIAL[cb.dataset.key];
|
|
647
|
+
});
|
|
648
|
+
update();
|
|
649
|
+
});
|
|
650
|
+
|
|
651
|
+
formCol.addEventListener("change", e => {
|
|
652
|
+
if (e.target.matches("input[type=checkbox]")) update();
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
// ---------------------------------------------------------------------------
|
|
656
|
+
// boot
|
|
657
|
+
// ---------------------------------------------------------------------------
|
|
658
|
+
|
|
659
|
+
buildForm();
|
|
660
|
+
update();
|
|
661
|
+
</script>
|
|
662
|
+
</body>
|
|
663
|
+
</html>
|