codymaster 7.0.2 → 7.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -0
- package/README.md +38 -1
- package/dist/agent/codex.js +73 -21
- package/dist/agent-dispatch.js +63 -48
- package/dist/cli/commands/brain.js +18 -0
- package/dist/cli/commands/design-studio.js +1 -1
- package/dist/cm-suggest.js +3 -3
- package/dist/dashboard-project-summary.js +9 -0
- package/dist/dashboard.js +11 -5
- package/dist/execution-analyzer.js +9 -1
- package/dist/judge.js +16 -15
- package/dist/mcp-context-server.js +45 -23
- package/dist/mcp-skills-tools.js +2 -2
- package/dist/skill-chain.js +26 -3
- package/dist/skill-token-report.js +105 -0
- package/dist/sprint-pipeline.js +3 -3
- package/dist/ui/onboarding.js +3 -4
- package/dist/utils/design-taste.js +1 -1
- package/dist/utils/output-compress.js +8 -0
- package/package.json +2 -1
- package/public/dashboard/app.js +40 -13
- package/public/dashboard/index.html +190 -5
- package/public/dashboard/style.css +1 -1
- package/scripts/build-skills.mjs +36 -2
- package/scripts/mcp-bridge.js +41 -24
- package/scripts/pack-plugin.mjs +206 -0
- package/skills/cm-ads-tracker/SKILL.md +401 -0
- package/skills/cm-ads-tracker/evals/evals.json +55 -0
- package/skills/cm-ads-tracker/references/gtm-architecture.md +321 -0
- package/skills/cm-ads-tracker/references/industry-events.md +294 -0
- package/skills/cm-ads-tracker/references/platforms-api.md +238 -0
- package/skills/cm-ads-tracker/templates/capi-payload.md +79 -0
- package/skills/cm-ads-tracker/templates/datalayer-push.js +104 -0
- package/skills/cm-ads-tracker/templates/gtm-variables.js +56 -0
- package/skills/cm-auto-publisher/SKILL.md +81 -0
- package/skills/cm-booking-calendar/SKILL.md +521 -0
- package/skills/cm-booking-calendar/references/industry-patterns.md +527 -0
- package/skills/cm-booking-calendar/templates/booking-form.css +626 -0
- package/skills/cm-booking-calendar/templates/booking-form.html +477 -0
- package/skills/cm-booking-calendar/templates/calendar-engine.js +419 -0
- package/skills/cm-booking-calendar/templates/calendar-export.js +395 -0
- package/skills/cm-booking-calendar/templates/reminder-config.js +629 -0
- package/skills/cm-brainstorm-idea/SKILL.md +5 -5
- package/skills/cm-code-review/SKILL.md +2 -2
- package/skills/cm-codeintell/SKILL.md +47 -580
- package/skills/cm-codeintell/references/integration-workflows.md +23 -0
- package/skills/cm-codeintell/references/layer-0-skeleton.md +54 -0
- package/skills/cm-codeintell/references/layer-1-codegraph.md +58 -0
- package/skills/cm-codeintell/references/layer-2-architecture.md +31 -0
- package/skills/cm-codeintell/references/layer-3-context-builder.md +32 -0
- package/skills/cm-content-factory/.content-factory-state.json +132 -0
- package/skills/cm-content-factory/.git 2/logs/refs/heads/main +1 -0
- package/skills/cm-content-factory/.git 2/logs/refs/remotes/origin/main +1 -0
- package/skills/cm-content-factory/.git 2/objects/02/fb0956734b5f8ba3f918b7defd04a89cfe0076 +0 -0
- package/skills/cm-content-factory/.git 2/objects/08/1e129d75dc6feac6c02037272e6bd1a04e3324 +0 -0
- package/skills/cm-content-factory/.git 2/objects/0c/5393416f3c5e01c9a655a802bff0dd52f76f0a +0 -0
- package/skills/cm-content-factory/.git 2/objects/10/0b9be46978a946a77188f68be725098a122001 +0 -0
- package/skills/cm-content-factory/.git 2/objects/10/cf041167fc9843610eb3d90259ef3396315fdc +0 -0
- package/skills/cm-content-factory/.git 2/objects/12/5e19538dd6e1338ffe74f6c4c165b00435bf48 +0 -0
- package/skills/cm-content-factory/.git 2/objects/16/a9b9d0088d5c1347628b45a2620b479d8ad57c +0 -0
- package/skills/cm-content-factory/.git 2/objects/17/8c2a9ef93c33ae4eec9d58e82321f9229843a1 +0 -0
- package/skills/cm-content-factory/.git 2/objects/25/397ae41d09104d763bdcac2695209d85cdea89 +0 -0
- package/skills/cm-content-factory/.git 2/objects/2f/a836b7947f2d458e1f639788bf4bb0983a3305 +0 -0
- package/skills/cm-content-factory/.git 2/objects/3a/baaaf0a1c0909c0828335791557125fba911e0 +0 -0
- package/skills/cm-content-factory/.git 2/objects/42/2924221b81f5ce3c4e4daac9a64a24f9b01f9a +0 -0
- package/skills/cm-content-factory/.git 2/objects/42/ec0ce707447dc11446a34c9995fb8533801731 +0 -0
- package/skills/cm-content-factory/.git 2/objects/46/e43ce92866d56ce74b1d750db307cfe6154a15 +0 -0
- package/skills/cm-content-factory/.git 2/objects/48/5e41b633c63f55b8277bcc59f44f67681f671a +0 -0
- package/skills/cm-content-factory/.git 2/objects/49/49c596a3a89fa240642acd95dd3258e261eb09 +0 -0
- package/skills/cm-content-factory/.git 2/objects/50/9d42d8412ef8eaf7f7e138476bac2e4d10ce60 +0 -0
- package/skills/cm-content-factory/.git 2/objects/55/0c8c389d981b463ef849aeb792d8be3ccb6ec8 +0 -0
- package/skills/cm-content-factory/.git 2/objects/5d/82d3b18410cdda3ace3677436f0cb599dbe2d2 +0 -0
- package/skills/cm-content-factory/.git 2/objects/60/0617c58e871a38b33bf29e282d132bb3c381ad +0 -0
- package/skills/cm-content-factory/.git 2/objects/6a/8369a99c687b7245c92ffaf0e0f0dab9014504 +0 -0
- package/skills/cm-content-factory/.git 2/objects/79/bea435d40ab531c1aaf6be0432c6a5b7aaed21 +0 -0
- package/skills/cm-content-factory/.git 2/objects/7e/5ebd79251c2f14e4aceb86c74b6b6daae6b500 +0 -0
- package/skills/cm-content-factory/.git 2/objects/81/98a822a60178d6d5023ddb3e222cddf048742e +0 -0
- package/skills/cm-content-factory/.git 2/objects/86/0a0e1943dfe53411d2e499a1f16f46a96ef758 +0 -0
- package/skills/cm-content-factory/.git 2/objects/86/971fb55fdc081fdbae52376f0f13e57a4e9b04 +0 -0
- package/skills/cm-content-factory/.git 2/objects/88/b89dd609a0a03f8d4fe8bfde20d5b8fc1d326d +0 -0
- package/skills/cm-content-factory/.git 2/objects/90/8737edb6b7809e32cc01590b4e08ba42a9d40d +0 -0
- package/skills/cm-content-factory/.git 2/objects/93/d5a8a9a7d4fb7f11491cb596a6880528725118 +0 -0
- package/skills/cm-content-factory/.git 2/objects/98/46a2ab81d0c3b3eb00ef88fc56989aa7e9f316 +0 -0
- package/skills/cm-content-factory/.git 2/objects/9b/d8dd1e49cf274eaf9c555f3ab39dce7af5715e +0 -0
- package/skills/cm-content-factory/.git 2/objects/a1/13329fb0cec96ae78b222d33a24c3b5bc7fa1f +0 -0
- package/skills/cm-content-factory/.git 2/objects/a9/e6effe626e8a3aea3a8fc3364b492191c6e7d0 +0 -0
- package/skills/cm-content-factory/.git 2/objects/ad/6de7e48d9782cca9353d1ff0aa1aab7fe1df85 +0 -0
- package/skills/cm-content-factory/.git 2/objects/af/54ae316f771ff692e299ffcd8bf2f06b413b59 +0 -0
- package/skills/cm-content-factory/.git 2/objects/b0/4cb8b0b00dad633e731c1472161419e738d674 +0 -0
- package/skills/cm-content-factory/.git 2/objects/b3/094abb0b9ed46419b269e4a4e36a459690e3b0 +0 -0
- package/skills/cm-content-factory/.git 2/objects/b9/435c5d4baac2cfc5c83009ddd27b46b60db5f1 +0 -0
- package/skills/cm-content-factory/.git 2/objects/ba/5da17dbaec5ec2dcfdfd126aead518d1171d5c +0 -0
- package/skills/cm-content-factory/.git 2/objects/c0/bf58703aa258ba5dd63083bebaec8f223d844c +0 -0
- package/skills/cm-content-factory/.git 2/objects/c4/701a34edf1fc1bad58ccc57bd03f9426acb59a +0 -0
- package/skills/cm-content-factory/.git 2/objects/c7/5ccce9a4e5cc74d9b3174550cf6d993ca43638 +0 -0
- package/skills/cm-content-factory/.git 2/objects/c7/710d59b5a35b0f1f0a0399386643a0bd94c929 +0 -0
- package/skills/cm-content-factory/.git 2/objects/d1/fe58237112e953e5fec52da22cf38e08be3df9 +5 -0
- package/skills/cm-content-factory/.git 2/objects/d2/2bbe9fd2f74c95bc5583e803f5e435f1e2cd86 +0 -0
- package/skills/cm-content-factory/.git 2/objects/d7/e72852ea2bff74581dbf247d400120086229f4 +0 -0
- package/skills/cm-content-factory/.git 2/objects/d8/d4c3b5553e4fd72807e1d4b49ef07d9ef3ac35 +0 -0
- package/skills/cm-content-factory/.git 2/objects/dc/75050c2876f6a02ae2a53a3c886f395b622977 +0 -0
- package/skills/cm-content-factory/.git 2/objects/ee/e8546f95acec500187c08a28a8b9ee02db0dec +0 -0
- package/skills/cm-content-factory/.git 2/objects/ef/263c059208b416c2146434f10cb2b9fabcba16 +0 -0
- package/skills/cm-content-factory/.git 2/objects/f3/ae597e84d9a59b88acd21c99bde2eaf686d785 +0 -0
- package/skills/cm-content-factory/.git 2/objects/f3/f6f5673c821d3d8e76fa267a9e882e7a5387ea +0 -0
- package/skills/cm-content-factory/.git 2/objects/f9/6e6d0ad02624dd11d5848594d056caef7a5e8b +0 -0
- package/skills/cm-content-factory/.git 2/objects/ff/278988fc1edf0db3abcf18de795f4cc0b4f3e1 +0 -0
- package/skills/cm-content-factory/.git 2/refs/heads/main +1 -0
- package/skills/cm-content-factory/.git 2/refs/remotes/origin/main +1 -0
- package/skills/cm-content-factory/.pytest_cache 2/v/cache/nodeids +76 -0
- package/skills/cm-content-factory/.pytest_cache 2/v/cache/stepwise +1 -0
- package/skills/cm-content-factory/AGENTS.md +61 -0
- package/skills/cm-content-factory/CLAUDE.md +63 -0
- package/skills/cm-content-factory/CURSOR.md +43 -0
- package/skills/cm-content-factory/Content Factory.zip +0 -0
- package/skills/cm-content-factory/SKILL.md +416 -0
- package/skills/cm-content-factory/cf +313 -0
- package/skills/cm-content-factory/config.schema.json +397 -0
- package/skills/cm-content-factory/dashboard/app.js +556 -0
- package/skills/cm-content-factory/dashboard/index.html +397 -0
- package/skills/cm-content-factory/dashboard/style.css +1211 -0
- package/skills/cm-content-factory/examples/01-real-estate.config.json +146 -0
- package/skills/cm-content-factory/examples/02-personal-finance.config.json +146 -0
- package/skills/cm-content-factory/examples/03-health-wellness.config.json +147 -0
- package/skills/cm-content-factory/examples/04-saas-software.config.json +147 -0
- package/skills/cm-content-factory/examples/05-legal-services.config.json +147 -0
- package/skills/cm-content-factory/examples/06-insurance.config.json +146 -0
- package/skills/cm-content-factory/examples/07-ecommerce-dropship.config.json +146 -0
- package/skills/cm-content-factory/examples/08-online-education.config.json +147 -0
- package/skills/cm-content-factory/examples/09-crypto-defi.config.json +147 -0
- package/skills/cm-content-factory/examples/10-beauty-skincare.config.json +147 -0
- package/skills/cm-content-factory/examples/11-home-services.config.json +146 -0
- package/skills/cm-content-factory/examples/12-dental-clinic.config.json +147 -0
- package/skills/cm-content-factory/examples/13-pet-care.config.json +147 -0
- package/skills/cm-content-factory/examples/14-travel-hospitality.config.json +147 -0
- package/skills/cm-content-factory/examples/15-ai-automation.config.json +147 -0
- package/skills/cm-content-factory/examples/16-wedding-events.config.json +147 -0
- package/skills/cm-content-factory/examples/17-fitness-coaching.config.json +148 -0
- package/skills/cm-content-factory/examples/18-cybersecurity.config.json +147 -0
- package/skills/cm-content-factory/examples/19-food-restaurant.config.json +148 -0
- package/skills/cm-content-factory/examples/20-solar-energy.config.json +147 -0
- package/skills/cm-content-factory/examples/fitness-blog.config.json +116 -0
- package/skills/cm-content-factory/examples/tech-blog.config.json +107 -0
- package/skills/cm-content-factory/extensions/EXTENSION_GUIDE.md +72 -0
- package/skills/cm-content-factory/extensions/hooks.py +126 -0
- package/skills/cm-content-factory/extensions/openclaw_adapter.py +132 -0
- package/skills/cm-content-factory/landing/docs/content/changelog.md +36 -0
- package/skills/cm-content-factory/landing/docs/content/deployment.md +46 -0
- package/skills/cm-content-factory/landing/docs/content/execution-flow.md +67 -0
- package/skills/cm-content-factory/landing/docs/content/openspace.md +27 -0
- package/skills/cm-content-factory/landing/docs/content/openviking.md +33 -0
- package/skills/cm-content-factory/landing/docs/content/use-cases.md +26 -0
- package/skills/cm-content-factory/landing/docs/content/v5-intro.md +28 -0
- package/skills/cm-content-factory/landing/docs/index.html +240 -0
- package/skills/cm-content-factory/landing/index.html +680 -0
- package/skills/cm-content-factory/landing/script.js +143 -0
- package/skills/cm-content-factory/landing/style.css +1216 -0
- package/skills/cm-content-factory/landing/translations.js +508 -0
- package/skills/cm-content-factory/logs/events.jsonl +11 -0
- package/skills/cm-content-factory/profiles/_template.profile.json +231 -0
- package/skills/cm-content-factory/profiles/finance.profile.json +278 -0
- package/skills/cm-content-factory/profiles/legal.profile.json +263 -0
- package/skills/cm-content-factory/profiles/medical-research.profile.json +321 -0
- package/skills/cm-content-factory/profiles/technology.profile.json +275 -0
- package/skills/cm-content-factory/scripts/agent_dispatcher.py +266 -0
- package/skills/cm-content-factory/scripts/audit.py +106 -0
- package/skills/cm-content-factory/scripts/dashboard_server.py +225 -0
- package/skills/cm-content-factory/scripts/deploy.py +146 -0
- package/skills/cm-content-factory/scripts/extract.py +132 -0
- package/skills/cm-content-factory/scripts/landing_generator.py +459 -0
- package/skills/cm-content-factory/scripts/memory.py +521 -0
- package/skills/cm-content-factory/scripts/monetize.py +239 -0
- package/skills/cm-content-factory/scripts/pipeline.py +357 -0
- package/skills/cm-content-factory/scripts/plan.py +163 -0
- package/skills/cm-content-factory/scripts/publish.py +145 -0
- package/skills/cm-content-factory/scripts/research.py +337 -0
- package/skills/cm-content-factory/scripts/scaffold.py +464 -0
- package/skills/cm-content-factory/scripts/scoreboard.py +336 -0
- package/skills/cm-content-factory/scripts/seo.py +90 -0
- package/skills/cm-content-factory/scripts/state_manager.py +320 -0
- package/skills/cm-content-factory/scripts/token_manager.py +268 -0
- package/skills/cm-content-factory/scripts/validate.py +221 -0
- package/skills/cm-content-factory/scripts/wizard.py +329 -0
- package/skills/cm-content-factory/scripts/write.py +93 -0
- package/skills/cm-content-factory/sites/docs-site/src/assets/houston.webp +0 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/architecture.md +90 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/data-flow.md +54 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/deployment.md +38 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/flows/index.md +65 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/flows/lc-content-lifecycle.md +48 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/flows/seq-write-mode.md +39 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/flows/uj-first-batch.md +42 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/flows/wf-content-pipeline.md +51 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/flows/wf-learning-cycle.md +52 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/getting-started/configuration.md +86 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/getting-started/installation.md +80 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/getting-started/intro.md +58 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/index.md +102 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/jtbd/index.md +45 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/jtbd/optimize-seo.md +29 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/jtbd/scale-content-production.md +55 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/jtbd/standardize-quality.md +29 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/personas/buyer-cmo-huong.md +41 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/personas/buyer-content-lead-khoa.md +40 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/personas/index.md +56 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/personas/user-content-manager-lan.md +46 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/personas/user-seo-minh.md +45 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/personas/user-writer-tu.md +45 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/sop/content-pipeline.md +108 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/sop/index.md +22 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/sop/memory-system.md +52 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/sop/seo-optimization.md +58 -0
- package/skills/cm-content-factory/sites/docs-site/src/content/docs/sop/troubleshooting-guide.md +92 -0
- package/skills/cm-content-factory/sites/docs-site/src/styles/custom.css +575 -0
- package/skills/cm-content-factory/tests/conftest.py +66 -0
- package/skills/cm-content-factory/tests/test_agent_dispatcher.py +125 -0
- package/skills/cm-content-factory/tests/test_memory.py +128 -0
- package/skills/cm-content-factory/tests/test_pipeline.py +107 -0
- package/skills/cm-content-factory/tests/test_research.py +56 -0
- package/skills/cm-content-factory/tests/test_state_manager.py +131 -0
- package/skills/cm-content-factory/tests/test_token_manager.py +110 -0
- package/skills/cm-content-factory/tests/test_wizard.py +121 -0
- package/skills/cm-continuity/SKILL.md +49 -480
- package/skills/cm-continuity/references/cm-uri-scheme.md +23 -0
- package/skills/cm-continuity/references/continuity-template.md +48 -0
- package/skills/cm-continuity/references/mcp-context-server.md +27 -0
- package/skills/cm-continuity/references/memory-architecture.md +26 -0
- package/skills/cm-continuity/references/memory-audit.md +18 -0
- package/skills/cm-continuity/references/session-protocol.md +31 -0
- package/skills/cm-continuity/references/storage-formats.md +20 -0
- package/skills/cm-cro-methodology/SKILL.md +290 -0
- package/skills/cm-cro-methodology/references/COPYWRITING.md +178 -0
- package/skills/cm-cro-methodology/references/OBJECTIONS.md +135 -0
- package/skills/cm-cro-methodology/references/PERSUASION.md +158 -0
- package/skills/cm-cro-methodology/references/RESEARCH.md +220 -0
- package/skills/cm-cro-methodology/references/funnel-analysis.md +365 -0
- package/skills/cm-cro-methodology/references/testing-methodology.md +330 -0
- package/skills/cm-design-system/SKILL.md +5 -6
- package/skills/cm-execution/SKILL.md +61 -379
- package/skills/cm-execution/references/mode-a-batch.md +28 -0
- package/skills/cm-execution/references/mode-b-subagent.md +46 -0
- package/skills/cm-execution/references/mode-c-parallel.md +39 -0
- package/skills/cm-execution/references/mode-d-rarv.md +62 -0
- package/skills/cm-execution/references/mode-e-triz-parallel.md +53 -0
- package/skills/cm-execution/references/mode-f-party.md +61 -0
- package/skills/cm-execution/references/persona-dispatch.md +22 -0
- package/skills/cm-execution/references/security-rules.md +47 -0
- package/skills/cm-google-form/SKILL.md +266 -0
- package/skills/cm-google-form/templates/apps-script.js +55 -0
- package/skills/cm-google-form/templates/form-markup.html +110 -0
- package/skills/cm-google-form/templates/form-submit.js +201 -0
- package/skills/cm-google-form/templates/toast.css +152 -0
- package/skills/cm-growth-hacking/SKILL.md +282 -0
- package/skills/cm-growth-hacking/bottom-sheet-engine.md +261 -0
- package/skills/cm-growth-hacking/calendar-integration.md +264 -0
- package/skills/cm-growth-hacking/references/engagement-patterns.md +346 -0
- package/skills/cm-growth-hacking/templates/bottom-sheet.css +528 -0
- package/skills/cm-growth-hacking/templates/bottom-sheet.js +269 -0
- package/skills/cm-growth-hacking/templates/calendar-cta.js +213 -0
- package/skills/cm-growth-hacking/templates/tracking-events.js +211 -0
- package/skills/cm-growth-hacking/templates/trigger-manager.js +254 -0
- package/skills/cm-growth-hacking/tracking-events.md +246 -0
- package/skills/cm-growth-hacking/trigger-system.md +342 -0
- package/skills/cm-how-it-work/SKILL.md +8 -9
- package/skills/cm-identity-guard/SKILL.md +4 -4
- package/skills/cm-jtbd/SKILL.md +98 -0
- package/skills/cm-notebooklm/SKILL.md +156 -0
- package/skills/cm-notebooklm/references/command_reference.md +94 -0
- package/skills/cm-notebooklm/references/workflows.md +60 -0
- package/skills/cm-notebooklm/resources/knowledge_sources.md +106 -0
- package/skills/cm-notebooklm/scripts/brain-sync.sh +453 -0
- package/skills/cm-notebooklm/scripts/graduate_wisdom.py +101 -0
- package/skills/cm-planning/SKILL.md +3 -3
- package/skills/cm-project-bootstrap/SKILL.md +2 -2
- package/skills/cm-quality-gate/SKILL.md +1 -1
- package/skills/cm-readit/SKILL.md +289 -0
- package/skills/cm-readit/audio-player.md +206 -0
- package/skills/cm-readit/examples/blog-reader.js +352 -0
- package/skills/cm-readit/examples/voice-cro.js +390 -0
- package/skills/cm-readit/tts-engine.md +262 -0
- package/skills/cm-readit/ui-patterns.md +362 -0
- package/skills/cm-readit/voice-cro.md +223 -0
- package/skills/cm-safe-deploy/SKILL.md +80 -510
- package/skills/cm-safe-deploy/references/gate-0-5-security-scan.md +31 -0
- package/skills/cm-safe-deploy/references/gate-0-secret-hygiene.md +68 -0
- package/skills/cm-safe-deploy/references/gate-1-syntax.md +23 -0
- package/skills/cm-safe-deploy/references/gate-2-test-suite.md +28 -0
- package/skills/cm-safe-deploy/references/gate-3-i18n.md +19 -0
- package/skills/cm-safe-deploy/references/gate-4-5-build-dist.md +16 -0
- package/skills/cm-safe-deploy/references/gate-6-deploy-smoke.md +18 -0
- package/skills/cm-safe-deploy/references/rollback.md +17 -0
- package/skills/cm-safe-deploy/references/setup-new-project.md +20 -0
- package/skills/cm-skill-index/SKILL.md +15 -15
- package/skills/cm-start/SKILL.md +1 -1
- package/skills/cm-tdd/SKILL.md +51 -356
- package/skills/cm-tdd/references/bugfix-example.md +15 -0
- package/skills/cm-tdd/references/rationalizations.md +20 -0
- package/skills/cm-tdd/references/red-green-refactor.md +33 -0
- package/skills/cm-tdd/references/stuck-debugging.md +18 -0
- package/skills/cm-tdd/references/test-quality.md +19 -0
- package/skills/cm-ux-master/SKILL.md +368 -115
- package/skills/profiles/core.txt +1 -4
- package/skills/profiles/design.txt +1 -2
- package/skills/profiles/full.txt +10 -16
- package/skills/profiles/growth.txt +9 -9
- package/skills/profiles/top35.json +13 -13
- package/skills/cm-conductor-worktrees/SKILL.archive.md +0 -28
- package/skills/cm-conductor-worktrees/SKILL.md +0 -26
- package/skills/cm-dashboard/SKILL.archive.md +0 -15
- package/skills/cm-dashboard/SKILL.md +0 -26
- package/skills/cm-dashboard/ui/app.js +0 -1278
- package/skills/cm-dashboard/ui/index.html +0 -206
- package/skills/cm-dashboard/ui/style.css +0 -440
- package/skills/cm-design-studio/SKILL.archive.md +0 -34
- package/skills/cm-design-studio/SKILL.md +0 -26
- package/skills/cm-engineering-meta/SKILL.archive.md +0 -73
- package/skills/cm-engineering-meta/SKILL.md +0 -26
- package/skills/cm-git-worktrees/SKILL.archive.md +0 -157
- package/skills/cm-git-worktrees/SKILL.md +0 -26
- package/skills/cm-post-deploy-canary/SKILL.archive.md +0 -22
- package/skills/cm-post-deploy-canary/SKILL.md +0 -26
- package/skills/cm-qa-visual-cli/SKILL.archive.md +0 -22
- package/skills/cm-qa-visual-cli/SKILL.md +0 -26
- package/skills/cm-second-opinion-cli/SKILL.archive.md +0 -23
- package/skills/cm-second-opinion-cli/SKILL.md +0 -26
- package/skills/cm-secret-shield/SKILL.archive.md +0 -580
- package/skills/cm-secret-shield/SKILL.md +0 -26
- package/skills/cm-security-gate/SKILL.archive.md +0 -239
- package/skills/cm-security-gate/SKILL.md +0 -26
- package/skills/cm-skill-health/SKILL.archive.md +0 -83
- package/skills/cm-skill-health/SKILL.md +0 -26
- package/skills/cm-skill-mastery/SKILL.archive.md +0 -156
- package/skills/cm-skill-mastery/SKILL.md +0 -26
- package/skills/cm-skill-search/SKILL.archive.md +0 -49
- package/skills/cm-skill-search/SKILL.md +0 -26
- package/skills/cm-skill-share/SKILL.archive.md +0 -58
- package/skills/cm-skill-share/SKILL.md +0 -26
- package/skills/cm-test-gate/SKILL.archive.md +0 -245
- package/skills/cm-test-gate/SKILL.md +0 -26
- package/skills/cm-ui-preview/SKILL.archive.md +0 -153
- package/skills/cm-ui-preview/SKILL.md +0 -26
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content Factory Dashboard — Client Application
|
|
3
|
+
* SSE connection with fallback to polling. Real-time UI updates.
|
|
4
|
+
* Collapsible log, actionable errors, settings dialog.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
(function () {
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
// ─── Config ───
|
|
11
|
+
const API_BASE = '';
|
|
12
|
+
const POLL_INTERVAL = 2000;
|
|
13
|
+
const SSE_RECONNECT_DELAY = 3000;
|
|
14
|
+
|
|
15
|
+
// ─── State ───
|
|
16
|
+
let currentState = null;
|
|
17
|
+
let eventSource = null;
|
|
18
|
+
let pollTimer = null;
|
|
19
|
+
let activeLogFilter = 'all';
|
|
20
|
+
let activeTaskFilter = 'all';
|
|
21
|
+
let allEvents = [];
|
|
22
|
+
let unseenLogCount = 0;
|
|
23
|
+
|
|
24
|
+
// ─── DOM Cache ───
|
|
25
|
+
const $ = (id) => document.getElementById(id);
|
|
26
|
+
const $$ = (sel) => document.querySelectorAll(sel);
|
|
27
|
+
|
|
28
|
+
// ─── Init ───
|
|
29
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
30
|
+
setupFilters();
|
|
31
|
+
setupSettings();
|
|
32
|
+
setupLogToggle();
|
|
33
|
+
updateClock();
|
|
34
|
+
setInterval(updateClock, 1000);
|
|
35
|
+
connectSSE();
|
|
36
|
+
fetchLogs();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// ─── SSE Connection ───
|
|
40
|
+
function connectSSE() {
|
|
41
|
+
setConnectionStatus('connecting');
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
eventSource = new EventSource(`${API_BASE}/api/events`);
|
|
45
|
+
|
|
46
|
+
eventSource.addEventListener('state', (e) => {
|
|
47
|
+
try {
|
|
48
|
+
const data = JSON.parse(e.data);
|
|
49
|
+
currentState = data;
|
|
50
|
+
renderAll(data);
|
|
51
|
+
setConnectionStatus('connected');
|
|
52
|
+
} catch (err) {
|
|
53
|
+
console.error('SSE parse error:', err);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
eventSource.onopen = () => {
|
|
58
|
+
setConnectionStatus('connected');
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
eventSource.onerror = () => {
|
|
62
|
+
setConnectionStatus('disconnected');
|
|
63
|
+
eventSource.close();
|
|
64
|
+
startPolling();
|
|
65
|
+
setTimeout(connectSSE, SSE_RECONNECT_DELAY);
|
|
66
|
+
};
|
|
67
|
+
} catch (e) {
|
|
68
|
+
startPolling();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function startPolling() {
|
|
73
|
+
if (pollTimer) return;
|
|
74
|
+
pollTimer = setInterval(async () => {
|
|
75
|
+
try {
|
|
76
|
+
const res = await fetch(`${API_BASE}/api/state`);
|
|
77
|
+
if (res.ok) {
|
|
78
|
+
const data = await res.json();
|
|
79
|
+
if (data.status !== 'no_data') {
|
|
80
|
+
currentState = data;
|
|
81
|
+
renderAll(data);
|
|
82
|
+
setConnectionStatus('connected');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
} catch { /* ignore */ }
|
|
86
|
+
}, POLL_INTERVAL);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async function fetchLogs() {
|
|
90
|
+
try {
|
|
91
|
+
const res = await fetch(`${API_BASE}/api/logs`);
|
|
92
|
+
if (res.ok) {
|
|
93
|
+
const newEvents = await res.json();
|
|
94
|
+
// Track unseen events when log is collapsed
|
|
95
|
+
const logSection = $('logSection');
|
|
96
|
+
if (logSection && !logSection.open && newEvents.length > allEvents.length) {
|
|
97
|
+
unseenLogCount += newEvents.length - allEvents.length;
|
|
98
|
+
updateLogBadge();
|
|
99
|
+
}
|
|
100
|
+
allEvents = newEvents;
|
|
101
|
+
renderLogs(allEvents);
|
|
102
|
+
|
|
103
|
+
// Auto-expand on error
|
|
104
|
+
const hasError = newEvents.some(e => e.level === 'error');
|
|
105
|
+
if (hasError && logSection && !logSection.open) {
|
|
106
|
+
logSection.open = true;
|
|
107
|
+
unseenLogCount = 0;
|
|
108
|
+
updateLogBadge();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
} catch { /* ignore */ }
|
|
112
|
+
|
|
113
|
+
setTimeout(fetchLogs, POLL_INTERVAL * 2);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// ─── Render All ───
|
|
117
|
+
function renderAll(state) {
|
|
118
|
+
renderStatusBar(state);
|
|
119
|
+
renderPipeline(state.pipeline);
|
|
120
|
+
renderTasks(state.tasks || []);
|
|
121
|
+
renderTokens(state.tokens || {});
|
|
122
|
+
renderErrors(state.errors || []);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// ─── Status Bar ───
|
|
126
|
+
function renderStatusBar(state) {
|
|
127
|
+
const statusMap = {
|
|
128
|
+
idle: 'Idle',
|
|
129
|
+
running: 'Running',
|
|
130
|
+
completed: 'Completed',
|
|
131
|
+
error: 'Error',
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
setText('pipelineStatus', statusMap[state.status] || state.status);
|
|
135
|
+
const stats = state.stats || {};
|
|
136
|
+
setText('articlesCount', `${stats.articles_written || 0} / ${stats.articles_total || 0}`);
|
|
137
|
+
setText('totalCost', `$${(state.tokens?.total_cost_usd || 0).toFixed(4)}`);
|
|
138
|
+
setText('agentCount', (state.agents || []).length);
|
|
139
|
+
|
|
140
|
+
const statusEl = $('pipelineStatus');
|
|
141
|
+
if (statusEl) {
|
|
142
|
+
statusEl.style.color = '';
|
|
143
|
+
if (state.status === 'running') statusEl.style.color = 'var(--status-running)';
|
|
144
|
+
else if (state.status === 'completed') statusEl.style.color = 'var(--status-done)';
|
|
145
|
+
else if (state.status === 'error') statusEl.style.color = 'var(--status-failed)';
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// ─── Pipeline ───
|
|
150
|
+
function renderPipeline(pipeline) {
|
|
151
|
+
if (!pipeline?.phases) return;
|
|
152
|
+
|
|
153
|
+
const phases = ['extract', 'plan', 'write', 'audit', 'seo', 'publish'];
|
|
154
|
+
phases.forEach((phase) => {
|
|
155
|
+
const node = document.querySelector(`.phase-node[data-phase="${phase}"]`);
|
|
156
|
+
if (!node) return;
|
|
157
|
+
|
|
158
|
+
const data = pipeline.phases[phase] || {};
|
|
159
|
+
node.setAttribute('data-status', data.status || 'pending');
|
|
160
|
+
|
|
161
|
+
const fill = node.querySelector('.phase-progress-fill');
|
|
162
|
+
if (fill) {
|
|
163
|
+
const pct = (data.progress || 0) * 100;
|
|
164
|
+
fill.style.width = `${pct}%`;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// ─── Tasks ───
|
|
170
|
+
function renderTasks(tasks) {
|
|
171
|
+
const container = $('taskList');
|
|
172
|
+
if (!container) return;
|
|
173
|
+
|
|
174
|
+
const filtered = activeTaskFilter === 'all'
|
|
175
|
+
? tasks
|
|
176
|
+
: tasks.filter((t) => t.status === activeTaskFilter);
|
|
177
|
+
|
|
178
|
+
if (filtered.length === 0) {
|
|
179
|
+
container.innerHTML = `
|
|
180
|
+
<div class="empty-state">
|
|
181
|
+
<svg width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
182
|
+
stroke-width="1.5" opacity="0.3">
|
|
183
|
+
<rect x="3" y="3" width="18" height="18" rx="2"/>
|
|
184
|
+
<path d="M3 9h18"/><path d="M9 21V9"/>
|
|
185
|
+
</svg>
|
|
186
|
+
<p>No ${activeTaskFilter === 'all' ? '' : activeTaskFilter + ' '}tasks${activeTaskFilter === 'all' ? '. Start a pipeline to see tasks here.' : '.'}</p>
|
|
187
|
+
</div>`;
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const sorted = [...filtered].reverse().slice(0, 50);
|
|
192
|
+
container.innerHTML = sorted.map((task) => {
|
|
193
|
+
const time = task.updated_at ? formatTime(task.updated_at) : '';
|
|
194
|
+
const meta = task.meta?.topic ? ` — ${task.meta.topic}` : '';
|
|
195
|
+
return `
|
|
196
|
+
<div class="task-item">
|
|
197
|
+
<span class="task-status-dot ${task.status}"></span>
|
|
198
|
+
<span class="task-id">${escapeHtml(task.id)}${escapeHtml(meta)}</span>
|
|
199
|
+
<span class="task-time">${time}</span>
|
|
200
|
+
</div>`;
|
|
201
|
+
}).join('');
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// ─── Tokens ───
|
|
205
|
+
function renderTokens(tokens) {
|
|
206
|
+
setText('inputTokens', formatNumber(tokens.total_input || 0));
|
|
207
|
+
setText('outputTokens', formatNumber(tokens.total_output || 0));
|
|
208
|
+
setText('tokenCost', `$${(tokens.total_cost_usd || 0).toFixed(4)}`);
|
|
209
|
+
|
|
210
|
+
const budgetSection = $('budgetSection');
|
|
211
|
+
if (budgetSection) {
|
|
212
|
+
if (tokens.budget_limit_usd) {
|
|
213
|
+
budgetSection.style.display = 'block';
|
|
214
|
+
const spent = tokens.total_cost_usd || 0;
|
|
215
|
+
const limit = tokens.budget_limit_usd;
|
|
216
|
+
const pct = Math.min(100, (spent / limit) * 100);
|
|
217
|
+
setText('budgetText', `$${spent.toFixed(4)} / $${limit.toFixed(2)}`);
|
|
218
|
+
const fill = $('budgetFill');
|
|
219
|
+
if (fill) {
|
|
220
|
+
fill.style.width = `${pct}%`;
|
|
221
|
+
fill.className = `budget-fill${pct > 80 ? ' warning' : ''}`;
|
|
222
|
+
}
|
|
223
|
+
} else {
|
|
224
|
+
budgetSection.style.display = 'none';
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Providers
|
|
229
|
+
const providerList = $('providerList');
|
|
230
|
+
if (!providerList) return;
|
|
231
|
+
|
|
232
|
+
const providers = tokens.providers || {};
|
|
233
|
+
const entries = Object.entries(providers);
|
|
234
|
+
if (entries.length === 0) {
|
|
235
|
+
providerList.innerHTML = '';
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
providerList.innerHTML = entries.map(([name, data]) => `
|
|
239
|
+
<div class="provider-item">
|
|
240
|
+
<span class="provider-name">${escapeHtml(name)}</span>
|
|
241
|
+
<span class="provider-stats">${data.requests} req · $${data.cost_usd.toFixed(4)} · ${data.failures || 0} fail</span>
|
|
242
|
+
</div>
|
|
243
|
+
`).join('');
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// ─── Logs ───
|
|
247
|
+
function renderLogs(events) {
|
|
248
|
+
const container = $('logViewer');
|
|
249
|
+
if (!container) return;
|
|
250
|
+
|
|
251
|
+
const filtered = activeLogFilter === 'all'
|
|
252
|
+
? events
|
|
253
|
+
: events.filter((e) => e.level === activeLogFilter);
|
|
254
|
+
|
|
255
|
+
if (filtered.length === 0) {
|
|
256
|
+
container.innerHTML = '<div class="empty-state"><p>No events to show.</p></div>';
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const recent = filtered.slice(-150);
|
|
261
|
+
container.innerHTML = recent.map((e) => {
|
|
262
|
+
const time = e.ts ? e.ts.slice(11, 19) : '';
|
|
263
|
+
const lvl = (e.level || 'info').toLowerCase();
|
|
264
|
+
return `
|
|
265
|
+
<div class="log-entry">
|
|
266
|
+
<span class="log-time">${time}</span>
|
|
267
|
+
<span class="log-level ${lvl}">${lvl.toUpperCase().padEnd(5)}</span>
|
|
268
|
+
<span class="log-msg">${escapeHtml(e.msg || '')}</span>
|
|
269
|
+
</div>`;
|
|
270
|
+
}).join('');
|
|
271
|
+
|
|
272
|
+
container.scrollTop = container.scrollHeight;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// ─── Errors — Actionable ───
|
|
276
|
+
function classifyError(error) {
|
|
277
|
+
const msg = (error.message || '').toLowerCase();
|
|
278
|
+
const source = (error.source || '').toLowerCase();
|
|
279
|
+
const combined = `${msg} ${source}`;
|
|
280
|
+
|
|
281
|
+
if (/token|limit|quota|budget|exceeded|rate.?limit/.test(combined)) {
|
|
282
|
+
return {
|
|
283
|
+
action: 'Add Token',
|
|
284
|
+
actionType: 'token',
|
|
285
|
+
icon: '🔑',
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
if (/api|service|provider|connection|timeout|network|refused|unreachable/.test(combined)) {
|
|
289
|
+
return {
|
|
290
|
+
action: 'Change Service',
|
|
291
|
+
actionType: 'service',
|
|
292
|
+
icon: '🔄',
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
if (/model|capability|context.?length|not.?found|deprecated|unsupported/.test(combined)) {
|
|
296
|
+
return {
|
|
297
|
+
action: 'Switch Model',
|
|
298
|
+
actionType: 'model',
|
|
299
|
+
icon: '🤖',
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
return {
|
|
303
|
+
action: 'View Details',
|
|
304
|
+
actionType: 'details',
|
|
305
|
+
icon: '📋',
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function handleErrorAction(actionType) {
|
|
310
|
+
const dialog = $('settingsDialog');
|
|
311
|
+
if (!dialog) return;
|
|
312
|
+
|
|
313
|
+
dialog.showModal();
|
|
314
|
+
|
|
315
|
+
// Focus relevant field based on error type
|
|
316
|
+
requestAnimationFrame(() => {
|
|
317
|
+
switch (actionType) {
|
|
318
|
+
case 'token':
|
|
319
|
+
const tokenInput = $('settingToken');
|
|
320
|
+
if (tokenInput) tokenInput.focus();
|
|
321
|
+
break;
|
|
322
|
+
case 'service':
|
|
323
|
+
const serviceSelect = $('settingService');
|
|
324
|
+
if (serviceSelect) serviceSelect.focus();
|
|
325
|
+
break;
|
|
326
|
+
case 'model':
|
|
327
|
+
const modelSelect = $('settingModel');
|
|
328
|
+
if (modelSelect) modelSelect.focus();
|
|
329
|
+
break;
|
|
330
|
+
case 'details':
|
|
331
|
+
// Open log section
|
|
332
|
+
const logSection = $('logSection');
|
|
333
|
+
if (logSection) logSection.open = true;
|
|
334
|
+
dialog.close();
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
function renderErrors(errors) {
|
|
341
|
+
const section = $('errorSection');
|
|
342
|
+
const list = $('errorList');
|
|
343
|
+
if (!section || !list) return;
|
|
344
|
+
|
|
345
|
+
if (errors.length === 0) {
|
|
346
|
+
section.style.display = 'none';
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
section.style.display = 'block';
|
|
351
|
+
list.innerHTML = errors.slice(-10).reverse().map((err) => {
|
|
352
|
+
const classified = classifyError(err);
|
|
353
|
+
const time = err.timestamp ? formatTime(err.timestamp) : '';
|
|
354
|
+
|
|
355
|
+
return `
|
|
356
|
+
<div class="error-item">
|
|
357
|
+
<div class="error-top">
|
|
358
|
+
<span class="error-icon">
|
|
359
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
360
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
361
|
+
<circle cx="12" cy="12" r="10"/>
|
|
362
|
+
<line x1="15" y1="9" x2="9" y2="15"/>
|
|
363
|
+
<line x1="9" y1="9" x2="15" y2="15"/>
|
|
364
|
+
</svg>
|
|
365
|
+
</span>
|
|
366
|
+
<div class="error-content">
|
|
367
|
+
<div class="error-source">${escapeHtml(err.source || 'unknown')}</div>
|
|
368
|
+
<div class="error-message">${escapeHtml(err.message || '')}</div>
|
|
369
|
+
</div>
|
|
370
|
+
<span class="error-time">${time}</span>
|
|
371
|
+
</div>
|
|
372
|
+
<div class="error-actions">
|
|
373
|
+
<button class="error-action-btn primary" data-action="${classified.actionType}"
|
|
374
|
+
aria-label="${classified.action}">
|
|
375
|
+
${classified.action}
|
|
376
|
+
</button>
|
|
377
|
+
<button class="error-action-btn secondary" data-action="details"
|
|
378
|
+
aria-label="View log">
|
|
379
|
+
View Log
|
|
380
|
+
</button>
|
|
381
|
+
</div>
|
|
382
|
+
</div>`;
|
|
383
|
+
}).join('');
|
|
384
|
+
|
|
385
|
+
// Attach event listeners to action buttons
|
|
386
|
+
list.querySelectorAll('.error-action-btn').forEach(btn => {
|
|
387
|
+
btn.addEventListener('click', (e) => {
|
|
388
|
+
e.preventDefault();
|
|
389
|
+
handleErrorAction(btn.dataset.action);
|
|
390
|
+
});
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// ─── Log Toggle ───
|
|
395
|
+
function setupLogToggle() {
|
|
396
|
+
const logSection = $('logSection');
|
|
397
|
+
if (!logSection) return;
|
|
398
|
+
|
|
399
|
+
logSection.addEventListener('toggle', () => {
|
|
400
|
+
if (logSection.open) {
|
|
401
|
+
unseenLogCount = 0;
|
|
402
|
+
updateLogBadge();
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
function updateLogBadge() {
|
|
408
|
+
const badge = $('logBadge');
|
|
409
|
+
if (!badge) return;
|
|
410
|
+
|
|
411
|
+
if (unseenLogCount > 0) {
|
|
412
|
+
badge.textContent = unseenLogCount > 99 ? '99+' : unseenLogCount;
|
|
413
|
+
badge.hidden = false;
|
|
414
|
+
} else {
|
|
415
|
+
badge.hidden = true;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// ─── Settings Dialog ───
|
|
420
|
+
function setupSettings() {
|
|
421
|
+
const dialog = $('settingsDialog');
|
|
422
|
+
const openBtn = $('settingsBtn');
|
|
423
|
+
const closeBtn = $('settingsClose');
|
|
424
|
+
const cancelBtn = $('settingsCancel');
|
|
425
|
+
const saveBtn = $('settingsSave');
|
|
426
|
+
const toggleVisBtn = $('toggleTokenVisibility');
|
|
427
|
+
|
|
428
|
+
if (!dialog) return;
|
|
429
|
+
|
|
430
|
+
// Open
|
|
431
|
+
if (openBtn) {
|
|
432
|
+
openBtn.addEventListener('click', () => {
|
|
433
|
+
dialog.showModal();
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// Close
|
|
438
|
+
const closeDialog = () => dialog.close();
|
|
439
|
+
if (closeBtn) closeBtn.addEventListener('click', closeDialog);
|
|
440
|
+
if (cancelBtn) cancelBtn.addEventListener('click', closeDialog);
|
|
441
|
+
|
|
442
|
+
// Click backdrop to close
|
|
443
|
+
dialog.addEventListener('click', (e) => {
|
|
444
|
+
if (e.target === dialog) closeDialog();
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
// Toggle token visibility
|
|
448
|
+
if (toggleVisBtn) {
|
|
449
|
+
toggleVisBtn.addEventListener('click', () => {
|
|
450
|
+
const input = $('settingToken');
|
|
451
|
+
if (!input) return;
|
|
452
|
+
const isPassword = input.type === 'password';
|
|
453
|
+
input.type = isPassword ? 'text' : 'password';
|
|
454
|
+
toggleVisBtn.setAttribute('aria-label', isPassword ? 'Hide token' : 'Show token');
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// Save (dispatch custom event for future backend integration)
|
|
459
|
+
if (saveBtn) {
|
|
460
|
+
saveBtn.addEventListener('click', () => {
|
|
461
|
+
const settings = {
|
|
462
|
+
service: $('settingService')?.value,
|
|
463
|
+
model: $('settingModel')?.value,
|
|
464
|
+
token: $('settingToken')?.value,
|
|
465
|
+
budget: parseFloat($('settingBudget')?.value) || null,
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
// Dispatch custom event
|
|
469
|
+
window.dispatchEvent(new CustomEvent('cf:settings-update', {
|
|
470
|
+
detail: settings,
|
|
471
|
+
}));
|
|
472
|
+
|
|
473
|
+
console.log('[Dashboard] Settings updated:', {
|
|
474
|
+
...settings,
|
|
475
|
+
token: settings.token ? '***' : null,
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
dialog.close();
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// ─── Filters ───
|
|
484
|
+
function setupFilters() {
|
|
485
|
+
// Task filters
|
|
486
|
+
$$('.task-filters .filter-btn').forEach((btn) => {
|
|
487
|
+
btn.addEventListener('click', () => {
|
|
488
|
+
$$('.task-filters .filter-btn').forEach((b) => {
|
|
489
|
+
b.classList.remove('active');
|
|
490
|
+
b.setAttribute('aria-selected', 'false');
|
|
491
|
+
});
|
|
492
|
+
btn.classList.add('active');
|
|
493
|
+
btn.setAttribute('aria-selected', 'true');
|
|
494
|
+
activeTaskFilter = btn.dataset.filter;
|
|
495
|
+
if (currentState) renderTasks(currentState.tasks || []);
|
|
496
|
+
});
|
|
497
|
+
});
|
|
498
|
+
|
|
499
|
+
// Log filters — stop propagation to prevent details toggle
|
|
500
|
+
$$('.log-filters .filter-btn').forEach((btn) => {
|
|
501
|
+
btn.addEventListener('click', (e) => {
|
|
502
|
+
e.stopPropagation();
|
|
503
|
+
e.preventDefault();
|
|
504
|
+
$$('.log-filters .filter-btn').forEach((b) => {
|
|
505
|
+
b.classList.remove('active');
|
|
506
|
+
b.setAttribute('aria-selected', 'false');
|
|
507
|
+
});
|
|
508
|
+
btn.classList.add('active');
|
|
509
|
+
btn.setAttribute('aria-selected', 'true');
|
|
510
|
+
activeLogFilter = btn.dataset.level;
|
|
511
|
+
renderLogs(allEvents);
|
|
512
|
+
});
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// ─── Connection Status ───
|
|
517
|
+
function setConnectionStatus(status) {
|
|
518
|
+
const el = $('connectionStatus');
|
|
519
|
+
if (!el) return;
|
|
520
|
+
el.className = `connection-status ${status}`;
|
|
521
|
+
const text = el.querySelector('.status-text');
|
|
522
|
+
const labels = { connecting: 'Connecting...', connected: 'Connected', disconnected: 'Reconnecting...' };
|
|
523
|
+
if (text) text.textContent = labels[status] || status;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// ─── Clock ───
|
|
527
|
+
function updateClock() {
|
|
528
|
+
const now = new Date();
|
|
529
|
+
setText('headerTime', now.toLocaleTimeString('en-US', { hour12: false }));
|
|
530
|
+
setText('footerTime', now.toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' }));
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// ─── Helpers ───
|
|
534
|
+
function setText(id, value) {
|
|
535
|
+
const el = $(id);
|
|
536
|
+
if (el) el.textContent = value;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
function formatNumber(n) {
|
|
540
|
+
return n.toLocaleString('en-US');
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
function formatTime(isoStr) {
|
|
544
|
+
try {
|
|
545
|
+
return new Date(isoStr).toLocaleTimeString('en-US', { hour12: false, hour: '2-digit', minute: '2-digit' });
|
|
546
|
+
} catch {
|
|
547
|
+
return '';
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
function escapeHtml(str) {
|
|
552
|
+
const div = document.createElement('div');
|
|
553
|
+
div.textContent = str;
|
|
554
|
+
return div.innerHTML;
|
|
555
|
+
}
|
|
556
|
+
})();
|