jammincms 0.1.1 → 0.1.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/dist/index.js +1 -1
- package/extension/content.js +64 -6
- package/extension/manifest.json +7 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -80,7 +80,7 @@ async function start(port) {
|
|
|
80
80
|
program
|
|
81
81
|
.name('jammincms')
|
|
82
82
|
.description('Local bridge server for Jammin CMS Chrome extension')
|
|
83
|
-
.version('1.
|
|
83
|
+
.version('0.1.3')
|
|
84
84
|
.option('-p, --port <port>', 'Port to listen on', '9876')
|
|
85
85
|
.action(async (options) => {
|
|
86
86
|
const port = parseInt(options.port, 10);
|
package/extension/content.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
var
|
|
1
|
+
var m=Object.defineProperty;var h=(l,t,e)=>t in l?m(l,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[t]=e;var o=(l,t,e)=>h(l,typeof t!="symbol"?t+"":t,e);function u(l){const t=[];let e=l;for(;e&&e!==document.body;){let i=e.tagName.toLowerCase();if(e.id){i=`#${e.id}`,t.unshift(i);break}if(e.className&&typeof e.className=="string"){const a=e.className.split(/\s+/).filter(s=>s&&!s.startsWith("jammin-")).slice(0,2);a.length>0&&(i+=`.${a.join(".")}`)}const n=e.parentElement;if(n){const a=Array.from(n.children).filter(s=>s.tagName===e.tagName);if(a.length>1){const s=a.indexOf(e)+1;i+=`:nth-child(${s})`}}t.unshift(i),e=e.parentElement}return t.join(" > ")}function p(l){const t=[];let e=l;for(;e&&e!==document.body;){let i=e.tagName.toLowerCase();if(e.id)i+=`#${e.id}`;else if(e.className&&typeof e.className=="string"){const n=e.className.split(/\s+/).filter(a=>a&&!a.startsWith("jammin-")).slice(0,2);n.length>0&&(i+=`.${n.join(".")}`)}if(t.unshift(i),e=e.parentElement,t.length>=4)break}return t.join(" > ")}class b{constructor(){o(this,"trackedElements",new Map);o(this,"config",null);o(this,"mutationObserver",null);o(this,"enabled",!1);o(this,"onDirtyChange",null);o(this,"selectionToolbar",null);this.handleInput=this.handleInput.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.handleFormatCommand=this.handleFormatCommand.bind(this)}setConfig(t){this.config=t}setDirtyChangeHandler(t){this.onDirtyChange=t}enable(){this.enabled||!this.config||(this.enabled=!0,this.setupEditableElements(),this.createSelectionToolbar(),this.startObserving(),document.addEventListener("keydown",this.handleKeydown),document.addEventListener("selectionchange",this.handleSelectionChange))}disable(){this.enabled&&(this.enabled=!1,this.stopObserving(),this.removeAllEditable(),this.destroySelectionToolbar(),document.removeEventListener("keydown",this.handleKeydown),document.removeEventListener("selectionchange",this.handleSelectionChange))}isEnabled(){return this.enabled}setupEditableElements(){if(this.config)for(const t of this.config.editableSelectors)document.querySelectorAll(t).forEach(i=>this.makeEditable(i))}makeEditable(t){if(this.trackedElements.has(t))return;t.contentEditable="true",t.classList.add("jammin-editable");const e={element:t,originalContent:t.innerHTML,selector:u(t),elementPath:p(t),isDirty:!1};this.trackedElements.set(t,e),t.addEventListener("input",this.handleInput)}removeEditable(t){this.trackedElements.get(t)&&(t.contentEditable="false",t.classList.remove("jammin-editable","jammin-dirty"),t.removeEventListener("input",this.handleInput),this.trackedElements.delete(t))}removeAllEditable(){for(const[t]of this.trackedElements)this.removeEditable(t)}handleInput(t){const e=t.target,i=this.trackedElements.get(e);if(!i)return;const a=e.innerHTML!==i.originalContent;a!==i.isDirty&&(i.isDirty=a,e.classList.toggle("jammin-dirty",a),this.notifyDirtyChange())}handleKeydown(t){if((t.metaKey||t.ctrlKey)&&t.key==="s"&&this.hasDirtyElements()&&(t.preventDefault(),document.dispatchEvent(new CustomEvent("jammin:save"))),(t.metaKey||t.ctrlKey)&&this.isInEditableArea())switch(t.key.toLowerCase()){case"b":t.preventDefault(),this.execFormat("bold");break;case"i":t.preventDefault(),this.execFormat("italic");break;case"k":t.preventDefault(),this.promptAndCreateLink();break}if(t.key==="Escape"){const e=document.activeElement;e&&this.trackedElements.has(e)&&(this.revertElement(e),e.blur())}}isInEditableArea(){var n,a;const t=window.getSelection();if(!t||t.isCollapsed)return!1;const e=t.anchorNode;return e?!!((a=(n=e.parentElement||e)==null?void 0:n.closest)==null?void 0:a.call(n,'[contenteditable="true"]')):!1}createSelectionToolbar(){if(this.selectionToolbar)return;const t=document.createElement("div");t.className="jammin-selection-toolbar",t.innerHTML=`
|
|
2
|
+
<button data-cmd="bold" title="Bold (Cmd+B)"><strong>B</strong></button>
|
|
3
|
+
<button data-cmd="italic" title="Italic (Cmd+I)"><em>I</em></button>
|
|
4
|
+
<button data-cmd="createLink" title="Link (Cmd+K)">Link</button>
|
|
5
|
+
<span class="jammin-sel-divider"></span>
|
|
6
|
+
<button data-cmd="formatBlock" data-value="h2" title="Heading 2">H2</button>
|
|
7
|
+
<button data-cmd="formatBlock" data-value="h3" title="Heading 3">H3</button>
|
|
8
|
+
<button data-cmd="formatBlock" data-value="p" title="Paragraph">P</button>
|
|
9
|
+
`,t.querySelectorAll("button").forEach(e=>{e.addEventListener("mousedown",i=>{i.preventDefault()}),e.addEventListener("click",this.handleFormatCommand)}),document.body.appendChild(t),this.selectionToolbar=t}destroySelectionToolbar(){this.selectionToolbar&&(this.selectionToolbar.remove(),this.selectionToolbar=null)}handleSelectionChange(){var n,a;const t=window.getSelection();if(!t||t.isCollapsed||t.toString().trim()===""){this.hideSelectionToolbar();return}const e=t.anchorNode;if(!e)return;if(!((a=(n=e.parentElement||e)==null?void 0:n.closest)==null?void 0:a.call(n,'[contenteditable="true"]'))){this.hideSelectionToolbar();return}this.showSelectionToolbar(t)}showSelectionToolbar(t){if(!this.selectionToolbar)return;const i=t.getRangeAt(0).getBoundingClientRect();this.selectionToolbar.style.display="flex",this.selectionToolbar.style.top=i.top-40+window.scrollY+"px",this.selectionToolbar.style.left=i.left+i.width/2-this.selectionToolbar.offsetWidth/2+"px"}hideSelectionToolbar(){this.selectionToolbar&&(this.selectionToolbar.style.display="none")}handleFormatCommand(t){const e=t.target,i=e.dataset.cmd,n=e.dataset.value;i&&(i==="createLink"?this.promptAndCreateLink():i==="formatBlock"&&n?this.execFormat(i,"<"+n+">"):this.execFormat(i),this.hideSelectionToolbar())}execFormat(t,e=null){document.execCommand(t,!1,e),this.markAllEditedElementsDirty()}promptAndCreateLink(){const t=prompt("Enter URL:");t&&(document.execCommand("createLink",!1,t),this.markAllEditedElementsDirty()),this.hideSelectionToolbar()}markAllEditedElementsDirty(){for(const[t,e]of this.trackedElements){const n=t.innerHTML!==e.originalContent;n!==e.isDirty&&(e.isDirty=n,t.classList.toggle("jammin-dirty",n))}this.notifyDirtyChange()}startObserving(){this.mutationObserver||(this.mutationObserver=new MutationObserver(t=>{for(const e of t)for(const i of e.addedNodes)i instanceof HTMLElement&&this.checkNewElement(i)}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0}))}stopObserving(){this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null)}checkNewElement(t){if(this.config)for(const e of this.config.editableSelectors)t.matches(e)&&this.makeEditable(t),t.querySelectorAll(e).forEach(i=>{this.makeEditable(i)})}notifyDirtyChange(){this.onDirtyChange&&this.onDirtyChange(this.hasDirtyElements())}hasDirtyElements(){for(const[,t]of this.trackedElements)if(t.isDirty)return!0;return!1}getDirtyChanges(){const t=[];for(const[e,i]of this.trackedElements)i.isDirty&&t.push({elementPath:i.elementPath,selector:i.selector,originalContent:i.originalContent,newContent:e.innerHTML});return t}revertElement(t){const e=this.trackedElements.get(t);e&&(t.innerHTML=e.originalContent,e.isDirty=!1,t.classList.remove("jammin-dirty"),this.notifyDirtyChange())}revertAll(){for(const[t,e]of this.trackedElements)e.isDirty&&(t.innerHTML=e.originalContent,e.isDirty=!1,t.classList.remove("jammin-dirty"));this.notifyDirtyChange()}markSaved(){for(const[t,e]of this.trackedElements)e.isDirty&&(e.originalContent=t.innerHTML,e.isDirty=!1,t.classList.remove("jammin-dirty"));this.notifyDirtyChange()}getDirtyCount(){let t=0;for(const[,e]of this.trackedElements)e.isDirty&&t++;return t}}function g(){return`
|
|
2
10
|
/* Reset */
|
|
3
11
|
*, *::before, *::after {
|
|
4
12
|
box-sizing: border-box;
|
|
@@ -426,7 +434,57 @@ var c=Object.defineProperty;var h=(l,t,e)=>t in l?c(l,t,{enumerable:!0,configura
|
|
|
426
434
|
outline-color: #f59e0b;
|
|
427
435
|
outline-style: solid;
|
|
428
436
|
}
|
|
429
|
-
|
|
437
|
+
|
|
438
|
+
/* Selection Toolbar */
|
|
439
|
+
.jammin-selection-toolbar {
|
|
440
|
+
position: absolute;
|
|
441
|
+
display: none;
|
|
442
|
+
align-items: center;
|
|
443
|
+
gap: 2px;
|
|
444
|
+
padding: 4px 6px;
|
|
445
|
+
background: #1e1e2e;
|
|
446
|
+
border: 1px solid #3a3a4e;
|
|
447
|
+
border-radius: 6px;
|
|
448
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
|
449
|
+
z-index: 2147483646;
|
|
450
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
.jammin-selection-toolbar button {
|
|
454
|
+
display: flex;
|
|
455
|
+
align-items: center;
|
|
456
|
+
justify-content: center;
|
|
457
|
+
min-width: 28px;
|
|
458
|
+
height: 28px;
|
|
459
|
+
padding: 0 8px;
|
|
460
|
+
background: transparent;
|
|
461
|
+
border: none;
|
|
462
|
+
border-radius: 4px;
|
|
463
|
+
color: #e0e0e0;
|
|
464
|
+
font-size: 13px;
|
|
465
|
+
cursor: pointer;
|
|
466
|
+
transition: background-color 0.15s;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
.jammin-selection-toolbar button:hover {
|
|
470
|
+
background: #3a3a4e;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
.jammin-selection-toolbar button strong {
|
|
474
|
+
font-weight: 700;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.jammin-selection-toolbar button em {
|
|
478
|
+
font-style: italic;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.jammin-selection-toolbar .jammin-sel-divider {
|
|
482
|
+
width: 1px;
|
|
483
|
+
height: 20px;
|
|
484
|
+
background: #3a3a4e;
|
|
485
|
+
margin: 0 4px;
|
|
486
|
+
}
|
|
487
|
+
`}class y{constructor(){o(this,"container",null);o(this,"shadowRoot",null);o(this,"expanded",!1);o(this,"outputExpanded",!1);o(this,"editEnabled",!1);o(this,"dirtyCount",0);o(this,"saving",!1);o(this,"config",null);o(this,"callbacks",null);o(this,"output","");o(this,"phase","idle");o(this,"filesChanged",[]);o(this,"error",null)}create(t,e){if(this.container)return;this.config=t,this.callbacks=e,this.container=document.createElement("div"),this.container.id="jammin-toolbar-container",this.shadowRoot=this.container.attachShadow({mode:"closed"});const i=document.createElement("style");i.textContent=g(),this.shadowRoot.appendChild(i);const n=document.createElement("div");n.className="jammin-toolbar",n.innerHTML=this.getToolbarHTML(),this.shadowRoot.appendChild(n),document.body.appendChild(this.container),this.setupEventListeners(),this.setExpanded(!1)}destroy(){this.container&&(this.container.remove(),this.container=null,this.shadowRoot=null)}getToolbarHTML(){var t;return`
|
|
430
488
|
<button class="jammin-toggle" title="Jammin CMS">
|
|
431
489
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
432
490
|
<path d="M12 19l7-7 3 3-7 7-3-3z"></path>
|
|
@@ -513,14 +571,14 @@ var c=Object.defineProperty;var h=(l,t,e)=>t in l?c(l,t,{enumerable:!0,configura
|
|
|
513
571
|
</div>
|
|
514
572
|
</div>
|
|
515
573
|
</div>
|
|
516
|
-
`}setupEventListeners(){if(!this.shadowRoot)return;const t=this.shadowRoot.querySelector(".jammin-toggle");t==null||t.addEventListener("click",()=>this.setExpanded(!this.expanded));const e=this.shadowRoot.querySelector(".jammin-close");e==null||e.addEventListener("click",()=>this.setExpanded(!1));const i=this.shadowRoot.querySelector("#jammin-edit-toggle");i==null||i.addEventListener("change",()=>{var r;this.editEnabled=i.checked,(r=this.callbacks)==null||r.onToggleEdit(this.editEnabled),this.updateUI()});const n=this.shadowRoot.querySelector("#jammin-save");n==null||n.addEventListener("click",()=>{var r;!this.saving&&this.dirtyCount>0&&((r=this.callbacks)==null||r.onSave())});const a=this.shadowRoot.querySelector("#jammin-revert");a==null||a.addEventListener("click",()=>{var r;this.dirtyCount>0&&((r=this.callbacks)==null||r.onRevert())});const
|
|
574
|
+
`}setupEventListeners(){if(!this.shadowRoot)return;const t=this.shadowRoot.querySelector(".jammin-toggle");t==null||t.addEventListener("click",()=>this.setExpanded(!this.expanded));const e=this.shadowRoot.querySelector(".jammin-close");e==null||e.addEventListener("click",()=>this.setExpanded(!1));const i=this.shadowRoot.querySelector("#jammin-edit-toggle");i==null||i.addEventListener("change",()=>{var r;this.editEnabled=i.checked,(r=this.callbacks)==null||r.onToggleEdit(this.editEnabled),this.updateUI()});const n=this.shadowRoot.querySelector("#jammin-save");n==null||n.addEventListener("click",()=>{var r;!this.saving&&this.dirtyCount>0&&((r=this.callbacks)==null||r.onSave())});const a=this.shadowRoot.querySelector("#jammin-revert");a==null||a.addEventListener("click",()=>{var r;this.dirtyCount>0&&((r=this.callbacks)==null||r.onRevert())});const s=this.shadowRoot.querySelector("#jammin-editor");s==null||s.addEventListener("click",()=>{var r;(r=this.callbacks)==null||r.onOpenEditor()});const d=this.shadowRoot.querySelector("#jammin-output-toggle");d==null||d.addEventListener("click",()=>{this.setOutputExpanded(!this.outputExpanded)});const c=this.shadowRoot.querySelector(".jammin-output-close");c==null||c.addEventListener("click",()=>{this.setOutputExpanded(!1)})}setExpanded(t){var n,a;this.expanded=t;const e=(n=this.shadowRoot)==null?void 0:n.querySelector(".jammin-panel-wrapper"),i=(a=this.shadowRoot)==null?void 0:a.querySelector(".jammin-toggle");t?(e==null||e.classList.add("expanded"),i==null||i.classList.add("hidden")):(e==null||e.classList.remove("expanded"),i==null||i.classList.remove("hidden"),this.setOutputExpanded(!1))}setOutputExpanded(t){var i;this.outputExpanded=t;const e=(i=this.shadowRoot)==null?void 0:i.querySelector(".jammin-output-drawer");t?e==null||e.classList.add("expanded"):e==null||e.classList.remove("expanded")}updateDirtyCount(t){this.dirtyCount=t,this.updateUI()}setSaving(t){this.saving=t,this.updateUI()}setStatus(t){var i;const e=(i=this.shadowRoot)==null?void 0:i.querySelector("#jammin-status-message");e&&(e.textContent=t)}updateUI(){if(!this.shadowRoot)return;const t=this.shadowRoot.querySelector(".jammin-badge");t&&(t.style.display=this.dirtyCount>0?"flex":"none",t.textContent=String(this.dirtyCount));const e=this.shadowRoot.querySelector("#jammin-save");if(e){e.disabled=this.dirtyCount===0||this.saving;const a=e.querySelector("span");a&&(a.textContent=this.saving?"Saving...":"Save")}const i=this.shadowRoot.querySelector("#jammin-revert");i&&(i.disabled=this.dirtyCount===0||this.saving);const n=this.shadowRoot.querySelector("#jammin-edit-toggle");n&&n.checked!==this.editEnabled&&(n.checked=this.editEnabled),this.updateOutputUI()}updateOutputUI(){if(!this.shadowRoot)return;const t=this.shadowRoot.querySelector(".jammin-status-indicator"),e=this.shadowRoot.querySelector(".jammin-status-phase");if(t&&(t.className="jammin-status-indicator",this.phase!=="idle"&&t.classList.add(`phase-${this.phase}`),this.error&&t.classList.add("phase-error")),e)if(this.error)e.textContent="Error";else switch(this.phase){case"idle":e.textContent="Ready";break;case"thinking":e.textContent="Thinking...";break;case"editing":e.textContent="Editing files...";break;case"complete":e.textContent="Complete";break}const i=this.shadowRoot.querySelector(".jammin-output-content");if(i){const s=this.output.replace(/\x1b\[[0-9;]*m/g,"").replace(/\r/g,"");i.textContent=s||"Waiting for output..."}const n=this.shadowRoot.querySelector(".jammin-output-footer");n&&(this.filesChanged.length>0?n.innerHTML=`
|
|
517
575
|
<div class="jammin-files-header">Files modified:</div>
|
|
518
576
|
<ul class="jammin-files-list">
|
|
519
|
-
${this.filesChanged.map(
|
|
577
|
+
${this.filesChanged.map(s=>`<li>${this.escapeHtml(s)}</li>`).join("")}
|
|
520
578
|
</ul>
|
|
521
|
-
`:this.error?n.innerHTML=`<div class="jammin-error">${this.escapeHtml(this.error)}</div>`:n.innerHTML="");const a=this.shadowRoot.querySelector(".jammin-output-body");a&&(a.scrollTop=a.scrollHeight)}setEditEnabled(t){this.editEnabled=t,this.updateUI()}resetOutput(){this.output="",this.phase="thinking",this.filesChanged=[],this.error=null,this.updateOutputUI()}addProgress(t){this.output+=t.output,this.phase=t.phase,this.updateOutputUI()}setComplete(t){this.phase="complete",this.filesChanged=t.filesChanged||[],this.error=t.error||null,this.updateOutputUI()}showOutput(){this.setOutputExpanded(!0)}hideOutput(){this.setOutputExpanded(!1)}toggleOutput(){this.setOutputExpanded(!this.outputExpanded)}escapeHtml(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}}class
|
|
579
|
+
`:this.error?n.innerHTML=`<div class="jammin-error">${this.escapeHtml(this.error)}</div>`:n.innerHTML="");const a=this.shadowRoot.querySelector(".jammin-output-body");a&&(a.scrollTop=a.scrollHeight)}setEditEnabled(t){this.editEnabled=t,this.updateUI()}resetOutput(){this.output="",this.phase="thinking",this.filesChanged=[],this.error=null,this.updateOutputUI()}addProgress(t){this.output+=t.output,this.phase=t.phase,this.updateOutputUI()}setComplete(t){this.phase="complete",this.filesChanged=t.filesChanged||[],this.error=t.error||null,this.updateOutputUI()}showOutput(){this.setOutputExpanded(!0)}hideOutput(){this.setOutputExpanded(!1)}toggleOutput(){this.setOutputExpanded(!this.outputExpanded)}escapeHtml(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}}class v{constructor(){o(this,"config",null);o(this,"editor",null);o(this,"toolbar",null);o(this,"currentJobId",null);o(this,"styleElement",null);o(this,"activated",!1);o(this,"pendingChanges",null);chrome.runtime.onMessage.addListener((t,e,i)=>t.action==="activate_cms"?(this.activate().then(()=>{i({success:!0,activated:this.activated})}),!0):t.action==="cms_status"?(i({activated:this.activated}),!1):(this.activated&&this.handleBackgroundMessage(t),!1))}async activate(){if(this.activated)return;const t=await this.getConfigForCurrentPage();if(!t){console.log("[Jammin] No matching config for this page");return}this.config=t,this.activated=!0,console.log("[Jammin] Activated for:",t.name),this.editor=new b,this.toolbar=new y,this.injectPageStyles(),this.editor.setConfig(t),this.editor.setDirtyChangeHandler(()=>{var e,i;(i=this.toolbar)==null||i.updateDirtyCount(((e=this.editor)==null?void 0:e.getDirtyCount())||0)}),this.toolbar.create(t,{onSave:()=>this.handleSave(),onRevert:()=>this.handleRevert(),onToggleEdit:e=>this.handleToggleEdit(e),onOpenEditor:()=>this.handleOpenEditor()}),document.addEventListener("jammin:save",()=>this.handleSave())}async getConfigForCurrentPage(){return new Promise(t=>{chrome.runtime.sendMessage({action:"get_site_config",payload:{url:window.location.href}},e=>{t(e==null?void 0:e.payload)})})}injectPageStyles(){this.styleElement=document.createElement("style"),this.styleElement.id="jammin-page-styles",this.styleElement.textContent=f(),document.head.appendChild(this.styleElement)}handleToggleEdit(t){!this.editor||!this.toolbar||(t?(this.editor.enable(),document.body.classList.add("jammin-editing-active")):(this.editor.disable(),document.body.classList.remove("jammin-editing-active")),this.toolbar.setEditEnabled(t))}async handleSave(){if(!this.config||!this.editor||!this.toolbar||!this.editor.hasDirtyElements())return;const t=this.editor.getDirtyChanges();t.length!==0&&(this.toolbar.setSaving(!0),this.toolbar.setStatus("Checking project..."),this.toolbar.resetOutput(),this.toolbar.showOutput(),this.pendingChanges={projectPath:this.config.localPath,siteUrl:window.location.href,changes:t,customInstructions:this.config.customInstructions},chrome.runtime.sendMessage({action:"submit_changes",payload:this.pendingChanges},e=>{var i,n,a;(e==null?void 0:e.action)==="job_accepted"?(this.currentJobId=e.payload.jobId,(i=this.toolbar)==null||i.setStatus("Claude is working...")):(e==null?void 0:e.action)==="error"&&((n=this.toolbar)==null||n.setSaving(!1),(a=this.toolbar)==null||a.setStatus("Error: "+e.payload.message),this.pendingChanges=null)}))}handleRevert(){!this.editor||!this.toolbar||(this.editor.revertAll(),this.toolbar.setStatus("Changes reverted"))}handleOpenEditor(){this.config&&chrome.runtime.sendMessage({action:"open_editor",payload:{projectPath:this.config.localPath}})}handleBackgroundMessage(t){var e;if(!(!this.toolbar||!this.editor))switch(t.action){case"job_progress":{const i=t.payload;i.jobId===this.currentJobId&&(this.toolbar.addProgress(i),this.toolbar.setStatus(i.phase==="editing"?"Editing files...":"Claude is thinking..."));break}case"job_complete":{const i=t.payload;if(i.jobId===this.currentJobId){if(this.toolbar.setComplete(i),this.toolbar.setSaving(!1),i.success){this.editor.markSaved();const n=((e=i.filesChanged)==null?void 0:e.length)||0;this.toolbar.setStatus(`Done! ${n} file${n!==1?"s":""} modified`)}else this.toolbar.setStatus("Error: "+(i.error||"Unknown error"));this.currentJobId=null}break}case"job_cancelled":{t.payload.jobId===this.currentJobId&&(this.toolbar.setSaving(!1),this.toolbar.setStatus("Cancelled"),this.currentJobId=null);break}case"git_dirty":{const i=t.payload;i.jobId===this.currentJobId&&this.handleGitDirty(i);break}case"error":{this.toolbar.setSaving(!1),this.toolbar.setStatus("Error: "+t.payload.message);break}}}handleGitDirty(t){if(!this.toolbar)return;const e=t.changedFiles.length,i=t.changedFiles.slice(0,5).join(`
|
|
522
580
|
`),n=e>5?`
|
|
523
581
|
... and ${e-5} more`:"";confirm(`This project has ${e} uncommitted change${e!==1?"s":""}:
|
|
524
582
|
${i}${n}
|
|
525
583
|
|
|
526
|
-
Do you want to proceed anyway?`)&&this.pendingChanges?chrome.runtime.sendMessage({action:"submit_changes_force",payload:this.pendingChanges},
|
|
584
|
+
Do you want to proceed anyway?`)&&this.pendingChanges?chrome.runtime.sendMessage({action:"submit_changes_force",payload:this.pendingChanges},s=>{var d,c,r;(s==null?void 0:s.action)==="job_accepted"?(this.currentJobId=s.payload.jobId,(d=this.toolbar)==null||d.setStatus("Claude is working...")):(s==null?void 0:s.action)==="error"&&((c=this.toolbar)==null||c.setSaving(!1),(r=this.toolbar)==null||r.setStatus("Error: "+s.payload.message))}):(this.toolbar.setSaving(!1),this.toolbar.setStatus("Cancelled - uncommitted changes"),this.currentJobId=null),this.pendingChanges=null}}new v;
|
package/extension/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"manifest_version": 3,
|
|
3
3
|
"name": "Jammin CMS",
|
|
4
4
|
"description": "Inline website editing with Claude Code",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "0.1.3",
|
|
6
6
|
"permissions": [
|
|
7
7
|
"storage",
|
|
8
8
|
"activeTab",
|
|
@@ -17,8 +17,12 @@
|
|
|
17
17
|
},
|
|
18
18
|
"content_scripts": [
|
|
19
19
|
{
|
|
20
|
-
"matches": [
|
|
21
|
-
|
|
20
|
+
"matches": [
|
|
21
|
+
"<all_urls>"
|
|
22
|
+
],
|
|
23
|
+
"js": [
|
|
24
|
+
"content.js"
|
|
25
|
+
],
|
|
22
26
|
"css": [],
|
|
23
27
|
"run_at": "document_idle"
|
|
24
28
|
}
|