codymaster 7.0.1 → 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 +117 -2
- 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 +3 -2
- 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,225 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Dashboard Server — HTTP server with SSE for Content Factory dashboard.
|
|
4
|
+
|
|
5
|
+
Serves the dashboard UI and provides API endpoints for state, logs, and events.
|
|
6
|
+
Zero external dependencies — uses Python stdlib only.
|
|
7
|
+
|
|
8
|
+
Usage:
|
|
9
|
+
python3 scripts/dashboard_server.py # Start on port 5050
|
|
10
|
+
python3 scripts/dashboard_server.py --port 8080 # Custom port
|
|
11
|
+
python3 scripts/dashboard_server.py --no-open # Don't open browser
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import json
|
|
15
|
+
import os
|
|
16
|
+
import sys
|
|
17
|
+
import time
|
|
18
|
+
import queue
|
|
19
|
+
import signal
|
|
20
|
+
import argparse
|
|
21
|
+
import threading
|
|
22
|
+
import webbrowser
|
|
23
|
+
from pathlib import Path
|
|
24
|
+
from http.server import HTTPServer, SimpleHTTPRequestHandler
|
|
25
|
+
from datetime import datetime
|
|
26
|
+
|
|
27
|
+
SCRIPT_DIR = Path(__file__).resolve().parent
|
|
28
|
+
SKILL_DIR = SCRIPT_DIR.parent
|
|
29
|
+
DASHBOARD_DIR = SKILL_DIR / "dashboard"
|
|
30
|
+
PROJECT_ROOT = Path(os.getcwd()).resolve()
|
|
31
|
+
STATE_FILE = PROJECT_ROOT / ".content-factory-state.json"
|
|
32
|
+
EVENTS_FILE = PROJECT_ROOT / "logs" / "events.jsonl"
|
|
33
|
+
TOKEN_FILE = PROJECT_ROOT / "logs" / "token_usage.json"
|
|
34
|
+
|
|
35
|
+
# SSE clients queue
|
|
36
|
+
sse_clients: list[queue.Queue] = []
|
|
37
|
+
sse_lock = threading.Lock()
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def broadcast_event(event_type: str, data: dict):
|
|
41
|
+
"""Send SSE event to all connected clients."""
|
|
42
|
+
msg = f"event: {event_type}\ndata: {json.dumps(data, ensure_ascii=False)}\n\n"
|
|
43
|
+
with sse_lock:
|
|
44
|
+
dead = []
|
|
45
|
+
for q in sse_clients:
|
|
46
|
+
try:
|
|
47
|
+
q.put_nowait(msg)
|
|
48
|
+
except queue.Full:
|
|
49
|
+
dead.append(q)
|
|
50
|
+
for q in dead:
|
|
51
|
+
sse_clients.remove(q)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class DashboardHandler(SimpleHTTPRequestHandler):
|
|
55
|
+
"""Custom handler for dashboard API + static files."""
|
|
56
|
+
|
|
57
|
+
def __init__(self, *args, **kwargs):
|
|
58
|
+
super().__init__(*args, directory=str(DASHBOARD_DIR), **kwargs)
|
|
59
|
+
|
|
60
|
+
def do_GET(self):
|
|
61
|
+
if self.path == "/api/state":
|
|
62
|
+
self._serve_json_file(STATE_FILE)
|
|
63
|
+
elif self.path == "/api/tokens":
|
|
64
|
+
self._serve_json_file(TOKEN_FILE)
|
|
65
|
+
elif self.path.startswith("/api/logs"):
|
|
66
|
+
self._serve_logs()
|
|
67
|
+
elif self.path == "/api/events":
|
|
68
|
+
self._serve_sse()
|
|
69
|
+
else:
|
|
70
|
+
# Serve static files from dashboard/
|
|
71
|
+
super().do_GET()
|
|
72
|
+
|
|
73
|
+
def _serve_json_file(self, filepath: Path):
|
|
74
|
+
"""Serve a JSON file."""
|
|
75
|
+
self.send_response(200)
|
|
76
|
+
self.send_header("Content-Type", "application/json")
|
|
77
|
+
self.send_header("Access-Control-Allow-Origin", "*")
|
|
78
|
+
self.send_header("Cache-Control", "no-cache")
|
|
79
|
+
self.end_headers()
|
|
80
|
+
|
|
81
|
+
if filepath.exists():
|
|
82
|
+
with open(filepath, "r", encoding="utf-8") as f:
|
|
83
|
+
self.wfile.write(f.read().encode("utf-8"))
|
|
84
|
+
else:
|
|
85
|
+
self.wfile.write(b'{"status":"no_data"}')
|
|
86
|
+
|
|
87
|
+
def _serve_logs(self):
|
|
88
|
+
"""Serve recent events from JSONL log."""
|
|
89
|
+
self.send_response(200)
|
|
90
|
+
self.send_header("Content-Type", "application/json")
|
|
91
|
+
self.send_header("Access-Control-Allow-Origin", "*")
|
|
92
|
+
self.send_header("Cache-Control", "no-cache")
|
|
93
|
+
self.end_headers()
|
|
94
|
+
|
|
95
|
+
events = []
|
|
96
|
+
if EVENTS_FILE.exists():
|
|
97
|
+
try:
|
|
98
|
+
with open(EVENTS_FILE, "r", encoding="utf-8") as f:
|
|
99
|
+
lines = f.readlines()
|
|
100
|
+
for line in lines[-200:]:
|
|
101
|
+
line = line.strip()
|
|
102
|
+
if line:
|
|
103
|
+
try:
|
|
104
|
+
events.append(json.loads(line))
|
|
105
|
+
except json.JSONDecodeError:
|
|
106
|
+
pass
|
|
107
|
+
except IOError:
|
|
108
|
+
pass
|
|
109
|
+
|
|
110
|
+
self.wfile.write(json.dumps(events, ensure_ascii=False).encode("utf-8"))
|
|
111
|
+
|
|
112
|
+
def _serve_sse(self):
|
|
113
|
+
"""Serve SSE event stream."""
|
|
114
|
+
self.send_response(200)
|
|
115
|
+
self.send_header("Content-Type", "text/event-stream")
|
|
116
|
+
self.send_header("Cache-Control", "no-cache")
|
|
117
|
+
self.send_header("Connection", "keep-alive")
|
|
118
|
+
self.send_header("Access-Control-Allow-Origin", "*")
|
|
119
|
+
self.end_headers()
|
|
120
|
+
|
|
121
|
+
client_queue = queue.Queue(maxsize=100)
|
|
122
|
+
with sse_lock:
|
|
123
|
+
sse_clients.append(client_queue)
|
|
124
|
+
|
|
125
|
+
try:
|
|
126
|
+
# Send initial state
|
|
127
|
+
if STATE_FILE.exists():
|
|
128
|
+
with open(STATE_FILE, "r", encoding="utf-8") as f:
|
|
129
|
+
data = f.read()
|
|
130
|
+
msg = f"event: state\ndata: {data}\n\n"
|
|
131
|
+
self.wfile.write(msg.encode("utf-8"))
|
|
132
|
+
self.wfile.flush()
|
|
133
|
+
|
|
134
|
+
while True:
|
|
135
|
+
try:
|
|
136
|
+
msg = client_queue.get(timeout=15)
|
|
137
|
+
self.wfile.write(msg.encode("utf-8"))
|
|
138
|
+
self.wfile.flush()
|
|
139
|
+
except queue.Empty:
|
|
140
|
+
# Send keepalive
|
|
141
|
+
self.wfile.write(b":keepalive\n\n")
|
|
142
|
+
self.wfile.flush()
|
|
143
|
+
except (BrokenPipeError, ConnectionResetError, OSError):
|
|
144
|
+
pass
|
|
145
|
+
finally:
|
|
146
|
+
with sse_lock:
|
|
147
|
+
if client_queue in sse_clients:
|
|
148
|
+
sse_clients.remove(client_queue)
|
|
149
|
+
|
|
150
|
+
def log_message(self, format, *args):
|
|
151
|
+
"""Suppress default logging for cleaner output."""
|
|
152
|
+
if "/api/" in str(args[0]):
|
|
153
|
+
return
|
|
154
|
+
super().log_message(format, *args)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
class FileWatcher(threading.Thread):
|
|
158
|
+
"""Watch state file for changes and broadcast via SSE."""
|
|
159
|
+
|
|
160
|
+
def __init__(self, filepath: Path, interval: float = 1.0):
|
|
161
|
+
super().__init__(daemon=True)
|
|
162
|
+
self.filepath = filepath
|
|
163
|
+
self.interval = interval
|
|
164
|
+
self._last_mtime = 0
|
|
165
|
+
self._stop = threading.Event()
|
|
166
|
+
|
|
167
|
+
def run(self):
|
|
168
|
+
while not self._stop.is_set():
|
|
169
|
+
try:
|
|
170
|
+
if self.filepath.exists():
|
|
171
|
+
mtime = self.filepath.stat().st_mtime
|
|
172
|
+
if mtime > self._last_mtime:
|
|
173
|
+
self._last_mtime = mtime
|
|
174
|
+
with open(self.filepath, "r", encoding="utf-8") as f:
|
|
175
|
+
data = json.load(f)
|
|
176
|
+
broadcast_event("state", data)
|
|
177
|
+
except (IOError, json.JSONDecodeError):
|
|
178
|
+
pass
|
|
179
|
+
self._stop.wait(self.interval)
|
|
180
|
+
|
|
181
|
+
def stop(self):
|
|
182
|
+
self._stop.set()
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def main():
|
|
186
|
+
parser = argparse.ArgumentParser(description="Content Factory Dashboard Server")
|
|
187
|
+
parser.add_argument("--port", type=int, default=5050, help="Server port (default: 5050)")
|
|
188
|
+
parser.add_argument("--no-open", action="store_true", help="Don't auto-open browser")
|
|
189
|
+
args = parser.parse_args()
|
|
190
|
+
|
|
191
|
+
if not DASHBOARD_DIR.exists():
|
|
192
|
+
print(f"❌ Dashboard not found: {DASHBOARD_DIR}")
|
|
193
|
+
sys.exit(1)
|
|
194
|
+
|
|
195
|
+
# Start file watcher for SSE
|
|
196
|
+
watcher = FileWatcher(STATE_FILE)
|
|
197
|
+
watcher.start()
|
|
198
|
+
|
|
199
|
+
# Create server
|
|
200
|
+
server = HTTPServer(("0.0.0.0", args.port), DashboardHandler)
|
|
201
|
+
url = f"http://localhost:{args.port}"
|
|
202
|
+
|
|
203
|
+
def shutdown(sig, frame):
|
|
204
|
+
print(f"\n🛑 Shutting down dashboard server...")
|
|
205
|
+
watcher.stop()
|
|
206
|
+
server.shutdown()
|
|
207
|
+
|
|
208
|
+
signal.signal(signal.SIGINT, shutdown)
|
|
209
|
+
signal.signal(signal.SIGTERM, shutdown)
|
|
210
|
+
|
|
211
|
+
print(f"\n{'═' * 50}")
|
|
212
|
+
print(f" 🏭 Content Factory Dashboard")
|
|
213
|
+
print(f" 🌐 {url}")
|
|
214
|
+
print(f" 📂 Project: {PROJECT_ROOT.name}")
|
|
215
|
+
print(f" Press Ctrl+C to stop")
|
|
216
|
+
print(f"{'═' * 50}\n")
|
|
217
|
+
|
|
218
|
+
if not args.no_open:
|
|
219
|
+
threading.Timer(1.0, lambda: webbrowser.open(url)).start()
|
|
220
|
+
|
|
221
|
+
server.serve_forever()
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
if __name__ == "__main__":
|
|
225
|
+
main()
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Deploy — Multi-platform deployment for content factory projects.
|
|
4
|
+
|
|
5
|
+
Supports: Cloudflare Pages, GitHub Pages, Netlify, Vercel.
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
python3 deploy.py --config content-factory.config.json
|
|
9
|
+
python3 deploy.py --config content-factory.config.json --target cloudflare
|
|
10
|
+
python3 deploy.py --config content-factory.config.json --dry-run
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import json
|
|
14
|
+
import sys
|
|
15
|
+
import subprocess
|
|
16
|
+
import argparse
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
DEPLOY_COMMANDS = {
|
|
21
|
+
"cloudflare": {
|
|
22
|
+
"build": "npm run build",
|
|
23
|
+
"deploy": "npx wrangler pages deploy ./dist --project-name={slug}",
|
|
24
|
+
"check": "npx wrangler --version"
|
|
25
|
+
},
|
|
26
|
+
"github": {
|
|
27
|
+
"build": "npm run build",
|
|
28
|
+
"deploy": "git add -A && git commit -m 'deploy: auto-publish {date}' && git push origin main",
|
|
29
|
+
"check": "git --version"
|
|
30
|
+
},
|
|
31
|
+
"netlify": {
|
|
32
|
+
"build": "npm run build",
|
|
33
|
+
"deploy": "npx netlify deploy --prod --dir=dist",
|
|
34
|
+
"check": "npx netlify --version"
|
|
35
|
+
},
|
|
36
|
+
"vercel": {
|
|
37
|
+
"build": "npm run build",
|
|
38
|
+
"deploy": "npx vercel deploy --prod ./dist",
|
|
39
|
+
"check": "npx vercel --version"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class DeployEngine:
|
|
45
|
+
"""Multi-platform deployment engine."""
|
|
46
|
+
|
|
47
|
+
def __init__(self, config_path: str):
|
|
48
|
+
with open(config_path, "r", encoding="utf-8") as f:
|
|
49
|
+
self.config = json.load(f)
|
|
50
|
+
self.project_root = Path(config_path).resolve().parent
|
|
51
|
+
self.brand = self.config.get("brand", {})
|
|
52
|
+
self.target = self.config.get("deploy", {}).get("target", "none")
|
|
53
|
+
|
|
54
|
+
def deploy(self, target: str = None, dry_run: bool = False):
|
|
55
|
+
"""Deploy the project."""
|
|
56
|
+
target = target or self.target
|
|
57
|
+
if target == "none" or target not in DEPLOY_COMMANDS:
|
|
58
|
+
print(f"\n ⚠️ No deploy target configured.")
|
|
59
|
+
print(f" Available: cloudflare, github, netlify, vercel")
|
|
60
|
+
print(f" Set in config: deploy.target")
|
|
61
|
+
return False
|
|
62
|
+
|
|
63
|
+
cmds = DEPLOY_COMMANDS[target]
|
|
64
|
+
slug = self.brand.get("name", "site").lower().replace(" ", "-")
|
|
65
|
+
from datetime import datetime
|
|
66
|
+
date = datetime.now().strftime("%Y-%m-%d %H:%M")
|
|
67
|
+
|
|
68
|
+
print(f"\n{'═' * 50}")
|
|
69
|
+
print(f" 🚀 DEPLOY to {target.upper()}")
|
|
70
|
+
print(f" Project: {self.brand.get('name', 'Unknown')}")
|
|
71
|
+
print(f"{'═' * 50}")
|
|
72
|
+
|
|
73
|
+
# Step 1: Build
|
|
74
|
+
build_cmd = cmds["build"]
|
|
75
|
+
print(f"\n 📦 Building: {build_cmd}")
|
|
76
|
+
if not dry_run:
|
|
77
|
+
result = subprocess.run(build_cmd, shell=True, cwd=self.project_root, capture_output=True, text=True)
|
|
78
|
+
if result.returncode != 0:
|
|
79
|
+
print(f" ❌ Build failed: {result.stderr[:200]}")
|
|
80
|
+
return False
|
|
81
|
+
print(f" ✅ Build success")
|
|
82
|
+
|
|
83
|
+
# Step 2: Deploy
|
|
84
|
+
deploy_cmd = cmds["deploy"].format(slug=slug, date=date)
|
|
85
|
+
print(f"\n 🚀 Deploying: {deploy_cmd}")
|
|
86
|
+
if not dry_run:
|
|
87
|
+
result = subprocess.run(deploy_cmd, shell=True, cwd=self.project_root, capture_output=True, text=True)
|
|
88
|
+
if result.returncode != 0:
|
|
89
|
+
print(f" ❌ Deploy failed: {result.stderr[:200]}")
|
|
90
|
+
return False
|
|
91
|
+
print(f" ✅ Deployed!")
|
|
92
|
+
if result.stdout:
|
|
93
|
+
# Try to find URL in output
|
|
94
|
+
for line in result.stdout.split('\n'):
|
|
95
|
+
if 'http' in line.lower():
|
|
96
|
+
print(f" 🌐 {line.strip()}")
|
|
97
|
+
else:
|
|
98
|
+
print(f" ⏭️ DRY RUN — skipped")
|
|
99
|
+
|
|
100
|
+
return True
|
|
101
|
+
|
|
102
|
+
def status(self):
|
|
103
|
+
"""Show deploy status."""
|
|
104
|
+
print(f"\n Deploy target: {self.target}")
|
|
105
|
+
print(f" Brand: {self.brand.get('name', 'Unknown')}")
|
|
106
|
+
|
|
107
|
+
if self.target in DEPLOY_COMMANDS:
|
|
108
|
+
check_cmd = DEPLOY_COMMANDS[self.target]["check"]
|
|
109
|
+
try:
|
|
110
|
+
result = subprocess.run(check_cmd, shell=True, capture_output=True, text=True, timeout=10)
|
|
111
|
+
if result.returncode == 0:
|
|
112
|
+
print(f" CLI: ✅ {result.stdout.strip()[:50]}")
|
|
113
|
+
else:
|
|
114
|
+
print(f" CLI: ❌ Not installed")
|
|
115
|
+
except Exception:
|
|
116
|
+
print(f" CLI: ❌ Error checking")
|
|
117
|
+
|
|
118
|
+
# Check deploy configs
|
|
119
|
+
configs = {
|
|
120
|
+
"cloudflare": self.project_root / "wrangler.toml",
|
|
121
|
+
"github": self.project_root / ".github/workflows/deploy.yml",
|
|
122
|
+
"netlify": self.project_root / "netlify.toml"
|
|
123
|
+
}
|
|
124
|
+
for name, path in configs.items():
|
|
125
|
+
status = "✅" if path.exists() else "⬜"
|
|
126
|
+
print(f" {name}: {status} {path.name}")
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def main():
|
|
130
|
+
parser = argparse.ArgumentParser(description="Deploy — Multi-platform deployment")
|
|
131
|
+
parser.add_argument("--config", required=True)
|
|
132
|
+
parser.add_argument("--target", choices=["cloudflare", "github", "netlify", "vercel"])
|
|
133
|
+
parser.add_argument("--dry-run", action="store_true")
|
|
134
|
+
parser.add_argument("--status", action="store_true")
|
|
135
|
+
args = parser.parse_args()
|
|
136
|
+
|
|
137
|
+
engine = DeployEngine(args.config)
|
|
138
|
+
|
|
139
|
+
if args.status:
|
|
140
|
+
engine.status()
|
|
141
|
+
else:
|
|
142
|
+
engine.deploy(target=args.target, dry_run=args.dry_run)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
if __name__ == "__main__":
|
|
146
|
+
main()
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Extract Phase — Config-driven source material extraction.
|
|
4
|
+
|
|
5
|
+
Reads source documents and produces structured knowledge-base JSON.
|
|
6
|
+
Delegates to the original docx_extractor.py or custom extractors based on config.
|
|
7
|
+
|
|
8
|
+
Usage:
|
|
9
|
+
python3 extract.py --config content-factory.config.json
|
|
10
|
+
python3 extract.py --config content-factory.config.json --dry-run
|
|
11
|
+
python3 extract.py --config content-factory.config.json --group CVG
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import json
|
|
15
|
+
import sys
|
|
16
|
+
import os
|
|
17
|
+
import argparse
|
|
18
|
+
import subprocess
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def load_config(config_path: str) -> dict:
|
|
23
|
+
with open(config_path, "r", encoding="utf-8") as f:
|
|
24
|
+
return json.load(f)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def run_docx_extractor(project_root: Path, config: dict, dry_run: bool, group: str = None):
|
|
28
|
+
"""Run DOCX extraction using existing project script or built-in."""
|
|
29
|
+
extractor = project_root / "scripts" / "docx_extractor.py"
|
|
30
|
+
if not extractor.exists():
|
|
31
|
+
print("❌ scripts/docx_extractor.py not found.")
|
|
32
|
+
print(" This script is required for DOCX source type.")
|
|
33
|
+
return False
|
|
34
|
+
|
|
35
|
+
cmd = ["python3", str(extractor)]
|
|
36
|
+
if dry_run:
|
|
37
|
+
cmd.append("--dry-run")
|
|
38
|
+
if group:
|
|
39
|
+
cmd.extend(["--group", group])
|
|
40
|
+
|
|
41
|
+
print(f" 📦 Running DOCX extractor...")
|
|
42
|
+
print(f" Source: {config['sources']['path']}")
|
|
43
|
+
print(f" Output: {config['output'].get('knowledge_dir', 'knowledge-base/')}")
|
|
44
|
+
|
|
45
|
+
result = subprocess.run(cmd, cwd=str(project_root))
|
|
46
|
+
return result.returncode == 0
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def run_markdown_extractor(project_root: Path, config: dict, dry_run: bool):
|
|
50
|
+
"""Extract knowledge from existing markdown files."""
|
|
51
|
+
source_path = project_root / config["sources"]["path"]
|
|
52
|
+
output_dir = project_root / config["output"].get("knowledge_dir", "knowledge-base/")
|
|
53
|
+
|
|
54
|
+
if not source_path.exists():
|
|
55
|
+
print(f"❌ Source path not found: {source_path}")
|
|
56
|
+
return False
|
|
57
|
+
|
|
58
|
+
md_files = list(source_path.rglob("*.md"))
|
|
59
|
+
print(f" 📄 Found {len(md_files)} markdown files")
|
|
60
|
+
|
|
61
|
+
if dry_run:
|
|
62
|
+
for f in md_files[:10]:
|
|
63
|
+
print(f" → {f.relative_to(project_root)}")
|
|
64
|
+
if len(md_files) > 10:
|
|
65
|
+
print(f" ... and {len(md_files) - 10} more")
|
|
66
|
+
return True
|
|
67
|
+
|
|
68
|
+
output_dir.mkdir(parents=True, exist_ok=True)
|
|
69
|
+
|
|
70
|
+
entries = []
|
|
71
|
+
for md_file in md_files:
|
|
72
|
+
with open(md_file, "r", encoding="utf-8") as f:
|
|
73
|
+
content = f.read()
|
|
74
|
+
|
|
75
|
+
# Simple extraction: title from first heading, content summary
|
|
76
|
+
import re
|
|
77
|
+
title_match = re.search(r'^#\s+(.+)$', content, re.MULTILINE)
|
|
78
|
+
title = title_match.group(1).strip() if title_match else md_file.stem
|
|
79
|
+
|
|
80
|
+
entries.append({
|
|
81
|
+
"name": title,
|
|
82
|
+
"source_file": str(md_file.relative_to(project_root)),
|
|
83
|
+
"content_preview": content[:500]
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
# Write index
|
|
87
|
+
index = {
|
|
88
|
+
"total_entries": len(entries),
|
|
89
|
+
"source_type": "markdown",
|
|
90
|
+
"extracted_at": __import__("datetime").datetime.now().isoformat(),
|
|
91
|
+
"entries": entries
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
index_file = output_dir / "index.json"
|
|
95
|
+
with open(index_file, "w", encoding="utf-8") as f:
|
|
96
|
+
json.dump(index, f, ensure_ascii=False, indent=2)
|
|
97
|
+
|
|
98
|
+
print(f" ✅ Extracted {len(entries)} entries → {index_file}")
|
|
99
|
+
return True
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def main():
|
|
103
|
+
parser = argparse.ArgumentParser(description="Extract Phase — Source material extraction")
|
|
104
|
+
parser.add_argument("--config", required=True, help="Path to config JSON")
|
|
105
|
+
parser.add_argument("--dry-run", action="store_true")
|
|
106
|
+
parser.add_argument("--group", help="Filter by group code")
|
|
107
|
+
args = parser.parse_args()
|
|
108
|
+
|
|
109
|
+
config = load_config(args.config)
|
|
110
|
+
project_root = Path(args.config).resolve().parent
|
|
111
|
+
source_type = config["sources"]["type"]
|
|
112
|
+
|
|
113
|
+
print(f"📦 EXTRACT Phase — Source type: {source_type}")
|
|
114
|
+
|
|
115
|
+
extractors = {
|
|
116
|
+
"docx": lambda: run_docx_extractor(project_root, config, args.dry_run, args.group),
|
|
117
|
+
"markdown": lambda: run_markdown_extractor(project_root, config, args.dry_run),
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
extractor = extractors.get(source_type)
|
|
121
|
+
if extractor:
|
|
122
|
+
success = extractor()
|
|
123
|
+
else:
|
|
124
|
+
print(f"⚠️ Source type '{source_type}' — use manual extraction or implement custom extractor")
|
|
125
|
+
print(f" Supported: {', '.join(extractors.keys())}")
|
|
126
|
+
success = True # Non-blocking
|
|
127
|
+
|
|
128
|
+
sys.exit(0 if success else 1)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
if __name__ == "__main__":
|
|
132
|
+
main()
|