coder-config 0.40.10 → 0.40.11
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/config-loader.js +14 -1
- package/lib/constants.js +1 -1
- package/package.json +1 -1
- package/ui/dist/assets/{index-CTytYK0Q.js → index-D9QGvYNF.js} +103 -103
- package/ui/dist/index.html +1 -1
package/config-loader.js
CHANGED
|
@@ -34,7 +34,20 @@ const { runCli } = require('./lib/cli');
|
|
|
34
34
|
|
|
35
35
|
class ClaudeConfigManager {
|
|
36
36
|
constructor() {
|
|
37
|
-
|
|
37
|
+
const home = process.env.HOME || '';
|
|
38
|
+
const newDir = path.join(home, '.coder-config');
|
|
39
|
+
const legacyDir = path.join(home, '.claude-config');
|
|
40
|
+
|
|
41
|
+
// Use new location, but fall back to legacy if it has data and new doesn't
|
|
42
|
+
if (process.env.CLAUDE_CONFIG_HOME) {
|
|
43
|
+
this.installDir = process.env.CLAUDE_CONFIG_HOME;
|
|
44
|
+
} else if (fs.existsSync(path.join(legacyDir, 'projects.json')) &&
|
|
45
|
+
!fs.existsSync(path.join(newDir, 'projects.json'))) {
|
|
46
|
+
// Legacy has data, new doesn't - use legacy for backwards compatibility
|
|
47
|
+
this.installDir = legacyDir;
|
|
48
|
+
} else {
|
|
49
|
+
this.installDir = newDir;
|
|
50
|
+
}
|
|
38
51
|
|
|
39
52
|
// Look for registry in multiple places
|
|
40
53
|
const possiblePaths = [
|
package/lib/constants.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coder-config",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.11",
|
|
4
4
|
"description": "Configuration manager for AI coding tools - Claude Code, Gemini CLI, Codex CLI, Antigravity. Manage MCPs, rules, permissions, memory, and workstreams.",
|
|
5
5
|
"author": "regression.io",
|
|
6
6
|
"main": "config-loader.js",
|
|
@@ -579,12 +579,12 @@ WARNING: This link could potentially be dangerous`)){const b=window.open();if(b)
|
|
|
579
579
|
`});++s<e.length;)s&&r.push({type:"text",value:`
|
|
580
580
|
`}),r.push(e[s]);return t&&e.length>0&&r.push({type:"text",value:`
|
|
581
581
|
`}),r}function Cw(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function kw(e,t){const r=H$(e,t),s=r.one(e,void 0),o=T$(r),u=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return o&&u.children.push({type:"text",value:`
|
|
582
|
-
`},o),u}function K$(e,t){return e&&"run"in e?async function(r,s){const o=kw(r,{file:s,...t});await e.run(o,s)}:function(r,s){return kw(r,{file:s,...e||t})}}function jw(e){if(e)throw e}var nm,Nw;function q$(){if(Nw)return nm;Nw=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Object.defineProperty,s=Object.getOwnPropertyDescriptor,o=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},u=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var m=e.call(f,"constructor"),h=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!m&&!h)return!1;var x;for(x in f);return typeof x>"u"||e.call(f,x)},d=function(f,m){r&&m.name==="__proto__"?r(f,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):f[m.name]=m.newValue},l=function(f,m){if(m==="__proto__")if(e.call(f,m)){if(s)return s(f,m).value}else return;return f[m]};return nm=function c(){var f,m,h,x,w,k,_=arguments[0],v=1,b=arguments.length,g=!1;for(typeof _=="boolean"&&(g=_,_=arguments[1]||{},v=2),(_==null||typeof _!="object"&&typeof _!="function")&&(_={});v<b;++v)if(f=arguments[v],f!=null)for(m in f)h=l(_,m),x=l(f,m),_!==x&&(g&&x&&(u(x)||(w=o(x)))?(w?(w=!1,k=h&&o(h)?h:[]):k=h&&u(h)?h:{},d(_,{name:m,newValue:c(g,k,x)})):typeof x<"u"&&d(_,{name:m,newValue:x}));return _},nm}var Y$=q$();const sm=ml(Y$);function sp(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function X$(){const e=[],t={run:r,use:s};return t;function r(...o){let u=-1;const d=o.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);l(null,...o);function l(c,...f){const m=e[++u];let h=-1;if(c){d(c);return}for(;++h<o.length;)(f[h]===null||f[h]===void 0)&&(f[h]=o[h]);o=f,m?J$(m,l)(...f):d(null,...f)}}function s(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function J$(e,t){let r;return s;function s(...d){const l=e.length>d.length;let c;l&&d.push(o);try{c=e.apply(this,d)}catch(f){const m=f;if(l&&r)throw m;return o(m)}l||(c&&c.then&&typeof c.then=="function"?c.then(u,o):c instanceof Error?o(c):u(c))}function o(d,...l){r||(r=!0,t(d,...l))}function u(d){o(null,d)}}const Yn={basename:Q$,dirname:Z$,extname:ez,join:tz,sep:"/"};function Q$(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ol(e);let r=0,s=-1,o=e.length,u;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(u){r=o+1;break}}else s<0&&(u=!0,s=o+1);return s<0?"":e.slice(r,s)}if(t===e)return"";let d=-1,l=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(u){r=o+1;break}}else d<0&&(u=!0,d=o+1),l>-1&&(e.codePointAt(o)===t.codePointAt(l--)?l<0&&(s=o):(l=-1,s=d));return r===s?s=d:s<0&&(s=e.length),e.slice(r,s)}function Z$(e){if(Ol(e),e.length===0)return".";let t=-1,r=e.length,s;for(;--r;)if(e.codePointAt(r)===47){if(s){t=r;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function ez(e){Ol(e);let t=e.length,r=-1,s=0,o=-1,u=0,d;for(;t--;){const l=e.codePointAt(t);if(l===47){if(d){s=t+1;break}continue}r<0&&(d=!0,r=t+1),l===46?o<0?o=t:u!==1&&(u=1):o>-1&&(u=-1)}return o<0||r<0||u===0||u===1&&o===r-1&&o===s+1?"":e.slice(o,r)}function tz(...e){let t=-1,r;for(;++t<e.length;)Ol(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":rz(r)}function rz(e){Ol(e);const t=e.codePointAt(0)===47;let r=nz(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function nz(e,t){let r="",s=0,o=-1,u=0,d=-1,l,c;for(;++d<=e.length;){if(d<e.length)l=e.codePointAt(d);else{if(l===47)break;l=47}if(l===47){if(!(o===d-1||u===1))if(o!==d-1&&u===2){if(r.length<2||s!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(c=r.lastIndexOf("/"),c!==r.length-1){c<0?(r="",s=0):(r=r.slice(0,c),s=r.length-1-r.lastIndexOf("/")),o=d,u=0;continue}}else if(r.length>0){r="",s=0,o=d,u=0;continue}}t&&(r=r.length>0?r+"/..":"..",s=2)}else r.length>0?r+="/"+e.slice(o+1,d):r=e.slice(o+1,d),s=d-o-1;o=d,u=0}else l===46&&u>-1?u++:u=-1}return r}function Ol(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const sz={cwd:iz};function iz(){return"/"}function ip(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function oz(e){if(typeof e=="string")e=new URL(e);else if(!ip(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return az(e)}function az(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const s=t.codePointAt(r+2);if(s===70||s===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const im=["history","path","basename","stem","extname","dirname"];class v2{constructor(t){let r;t?ip(t)?r={path:t}:typeof t=="string"||lz(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":sz.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<im.length;){const u=im[s];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let o;for(o in r)im.includes(o)||(this[o]=r[o])}get basename(){return typeof this.path=="string"?Yn.basename(this.path):void 0}set basename(t){am(t,"basename"),om(t,"basename"),this.path=Yn.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Yn.dirname(this.path):void 0}set dirname(t){Ew(this.basename,"dirname"),this.path=Yn.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Yn.extname(this.path):void 0}set extname(t){if(om(t,"extname"),Ew(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Yn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ip(t)&&(t=oz(t)),am(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Yn.basename(this.path,this.extname):void 0}set stem(t){am(t,"stem"),om(t,"stem"),this.path=Yn.join(this.dirname||"",t+(this.extname||""))}fail(t,r,s){const o=this.message(t,r,s);throw o.fatal=!0,o}info(t,r,s){const o=this.message(t,r,s);return o.fatal=void 0,o}message(t,r,s){const o=new Dr(t,r,s);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function om(e,t){if(e&&e.includes(Yn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Yn.sep+"`")}function am(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Ew(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function lz(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const cz=(function(e){const s=this.constructor.prototype,o=s[e],u=function(){return o.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),uz={}.hasOwnProperty;class Yg extends cz{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=X$()}copy(){const t=new Yg;let r=-1;for(;++r<this.attachers.length;){const s=this.attachers[r];t.use(...s)}return t.data(sm(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(um("data",this.frozen),this.namespace[t]=r,this):uz.call(this.namespace,t)&&this.namespace[t]||void 0:t?(um("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const o=r.call(t,...s);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=ou(t),s=this.parser||this.Parser;return lm("parse",s),s(String(r),r)}process(t,r){const s=this;return this.freeze(),lm("process",this.parser||this.Parser),cm("process",this.compiler||this.Compiler),r?o(void 0,r):new Promise(o);function o(u,d){const l=ou(t),c=s.parse(l);s.run(c,l,function(m,h,x){if(m||!h||!x)return f(m);const w=h,k=s.stringify(w,x);fz(k)?x.value=k:x.result=k,f(m,x)});function f(m,h){m||!h?d(m):u?u(h):r(void 0,h)}}}processSync(t){let r=!1,s;return this.freeze(),lm("processSync",this.parser||this.Parser),cm("processSync",this.compiler||this.Compiler),this.process(t,o),Aw("processSync","process",r),s;function o(u,d){r=!0,jw(u),s=d}}run(t,r,s){Pw(t),this.freeze();const o=this.transformers;return!s&&typeof r=="function"&&(s=r,r=void 0),s?u(void 0,s):new Promise(u);function u(d,l){const c=ou(r);o.run(t,c,f);function f(m,h,x){const w=h||t;m?l(m):d?d(w):s(void 0,w,x)}}}runSync(t,r){let s=!1,o;return this.run(t,r,u),Aw("runSync","run",s),o;function u(d,l){jw(d),o=l,s=!0}}stringify(t,r){this.freeze();const s=ou(r),o=this.compiler||this.Compiler;return cm("stringify",o),Pw(t),o(t,s)}use(t,...r){const s=this.attachers,o=this.namespace;if(um("use",this.frozen),t!=null)if(typeof t=="function")c(t,r);else if(typeof t=="object")Array.isArray(t)?l(t):d(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function u(f){if(typeof f=="function")c(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[m,...h]=f;c(m,h)}else d(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function d(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(f.plugins),f.settings&&(o.settings=sm(!0,o.settings,f.settings))}function l(f){let m=-1;if(f!=null)if(Array.isArray(f))for(;++m<f.length;){const h=f[m];u(h)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function c(f,m){let h=-1,x=-1;for(;++h<s.length;)if(s[h][0]===f){x=h;break}if(x===-1)s.push([f,...m]);else if(m.length>0){let[w,...k]=m;const _=s[x][1];sp(_)&&sp(w)&&(w=sm(!0,_,w)),s[x]=[f,w,...k]}}}}const dz=new Yg().freeze();function lm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function cm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function um(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Pw(e){if(!sp(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Aw(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ou(e){return hz(e)?e:new v2(e)}function hz(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function fz(e){return typeof e=="string"||mz(e)}function mz(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const pz="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Tw=[],Rw={allowDangerousHtml:!0},gz=/^(https?|ircs?|mailto|xmpp)$/i,xz=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function vz(e){const t=yz(e),r=bz(e);return wz(t.runSync(t.parse(r),r),e)}function yz(e){const t=e.rehypePlugins||Tw,r=e.remarkPlugins||Tw,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Rw}:Rw;return dz().use(Q9).use(r).use(K$,s).use(t)}function bz(e){const t=e.children||"",r=new v2;return typeof t=="string"&&(r.value=t),r}function wz(e,t){const r=t.allowedElements,s=t.allowElement,o=t.components,u=t.disallowedElements,d=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||_z;for(const m of xz)Object.hasOwn(t,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+pz+m.id,void 0);return x2(e,f),T8(e,{Fragment:n.Fragment,components:o,ignoreInvalidStyle:!0,jsx:n.jsx,jsxs:n.jsxs,passKeys:!0,passNode:!0});function f(m,h,x){if(m.type==="raw"&&x&&typeof h=="number")return d?x.children.splice(h,1):x.children[h]={type:"text",value:m.value},h;if(m.type==="element"){let w;for(w in em)if(Object.hasOwn(em,w)&&Object.hasOwn(m.properties,w)){const k=m.properties[w],_=em[w];(_===null||_.includes(m.tagName))&&(m.properties[w]=c(String(k||""),w,m))}}if(m.type==="element"){let w=r?!r.includes(m.tagName):u?u.includes(m.tagName):!1;if(!w&&s&&typeof h=="number"&&(w=!s(m,h,x)),w&&x&&typeof h=="number")return l&&m.children?x.children.splice(h,1,...m.children):x.children.splice(h,1),h}}}function _z(e){const t=e.indexOf(":"),r=e.indexOf("?"),s=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||r!==-1&&t>r||s!==-1&&t>s||gz.test(e.slice(0,t))?e:""}function Sz(){var z,K;const[e,t]=C.useState(null),[r,s]=C.useState(""),[o,u]=C.useState({open:!1,field:null,type:"directory"}),[d,l]=C.useState(!0),[c,f]=C.useState(!1),[m,h]=C.useState(null),[x,w]=C.useState(!1),[k,_]=C.useState(null),[v,b]=C.useState([]),[g,y]=C.useState({open:!1,content:"",loading:!1});C.useEffect(()=>{I(),j(),E()},[]);const j=async()=>{try{const G=await ke.checkVersion();h(G)}catch(G){console.error("Failed to load version info:",G)}},E=async()=>{try{const G=await ke.getProject();_(G.dir),P(G.dir)}catch(G){console.error("Failed to load project info:",G)}},P=async G=>{if(G)try{const U=await ke.getHiddenSubprojects(G);b(U.hidden||[])}catch(U){console.error("Failed to load hidden sub-projects:",U)}},T=async G=>{if(k)try{const U=await ke.unhideSubproject(k,G);U.success?(ee.success("Sub-project unhidden"),P(k)):ee.error(U.error||"Failed to unhide")}catch(U){ee.error("Failed to unhide: "+U.message)}},N=async()=>{var G;if(!(m!=null&&m.updateAvailable)){ee.error("No update available");return}w(!0);try{const U=await ke.performUpdate({updateMethod:m.updateMethod,sourcePath:m.sourcePath});U.success?(U.updateMethod==="npm"?ee.success(U.message||"Updated via npm! Restart the server to apply."):ee.success(`Updated! Files: ${((G=U.updated)==null?void 0:G.join(", "))||"all"}. Restart the server to apply.`),j()):ee.error("Update failed: "+U.error)}catch(U){ee.error("Update failed: "+U.message)}finally{w(!1)}},R=async()=>{y(G=>({...G,open:!0,loading:!0}));try{const G=await ke.getChangelog();G.success?y(U=>({...U,content:G.content,loading:!1})):(ee.error("Failed to load changelog"),y(U=>({...U,open:!1,loading:!1})))}catch(G){ee.error("Failed to load changelog: "+G.message),y(U=>({...U,open:!1,loading:!1}))}},I=async()=>{try{l(!0);const G=await ke.getConfig();t(G.config),s(G.path)}catch{ee.error("Failed to load settings")}finally{l(!1)}},O=async()=>{f(!0);try{await ke.saveConfig(e),ee.success("Preferences saved!")}catch{ee.error("Failed to save preferences")}finally{f(!1)}},$=(G,U)=>{t(L=>({...L,[G]:U}))},W=(G,U,L)=>{t(M=>({...M,[G]:{...M[G],[U]:L}}))},Y=async G=>{const U=(e==null?void 0:e.enabledTools)||["claude"];let L;if(U.includes(G)){if(U.length<=1){ee.error("At least one tool must be enabled");return}L=U.filter(B=>B!==G)}else L=[...U,G];const M={...e,enabledTools:L};t(M);try{await ke.saveConfig(M),ee.success(`${G==="claude"?"Claude Code":G==="gemini"?"Gemini CLI":"Antigravity"} ${L.includes(G)?"enabled":"disabled"}`)}catch{t(e),ee.error("Failed to save preference")}};return d?n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx(ut,{className:"w-8 h-8 animate-spin text-primary"})}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-lg bg-muted flex items-center justify-center",children:n.jsx(A1,{className:"w-5 h-5 text-muted-foreground"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"claude-config Preferences"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Tool settings for this configuration manager"})]})]}),n.jsxs("div",{className:"bg-card rounded-xl border border-border p-6 shadow-sm",children:[n.jsxs("div",{className:"flex items-center justify-between mb-6",children:[n.jsx("div",{children:n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Stored in: ",n.jsx("code",{className:"bg-muted px-2 py-0.5 rounded",children:r})]})}),n.jsxs(le,{onClick:O,disabled:c,children:[c?n.jsx(ut,{className:"w-4 h-4 mr-2 animate-spin"}):n.jsx(ui,{className:"w-4 h-4 mr-2"}),"Save"]})]}),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"border-b border-border pb-6",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(wr,{className:"w-4 h-4"}),"Directories"]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"MCP Tools Directories"}),n.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Folders containing local MCP tool repositories for discovery"}),n.jsxs("div",{className:"space-y-2",children:[((e==null?void 0:e.toolsDirs)||(e!=null&&e.toolsDir?[e.toolsDir]:[])).map((G,U)=>n.jsxs("div",{className:"flex gap-2",children:[n.jsx(ct,{value:G||"",onChange:L=>{const M=[...(e==null?void 0:e.toolsDirs)||(e!=null&&e.toolsDir?[e.toolsDir]:[])];M[U]=L.target.value,$("toolsDirs",M),e!=null&&e.toolsDir&&t(B=>{const{toolsDir:q,...F}=B;return{...F,toolsDirs:M}})},placeholder:"~/mcp-tools",className:"font-mono flex-1"}),n.jsx(le,{variant:"outline",size:"icon",onClick:()=>u({open:!0,field:"toolsDirs",type:"directory",index:U}),title:"Browse...",children:n.jsx(si,{className:"w-4 h-4"})}),n.jsx(le,{variant:"outline",size:"icon",onClick:()=>{const M=((e==null?void 0:e.toolsDirs)||(e!=null&&e.toolsDir?[e.toolsDir]:[])).filter((B,q)=>q!==U);t(B=>{const{toolsDir:q,...F}=B;return{...F,toolsDirs:M.length>0?M:void 0}})},title:"Remove",className:"text-destructive hover:text-destructive",children:n.jsx(ei,{className:"w-4 h-4"})})]},U)),n.jsxs(le,{variant:"outline",size:"sm",onClick:()=>u({open:!0,field:"toolsDirs",type:"directory",index:-1}),className:"mt-2",children:[n.jsx(Mi,{className:"w-4 h-4 mr-2"}),"Add Tools Folder"]})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Global Registry Path"}),n.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Path to the global MCP registry file"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(ct,{value:(e==null?void 0:e.registryPath)||"",onChange:G=>$("registryPath",G.target.value),placeholder:"~/.claude/registry.json",className:"font-mono flex-1"}),n.jsx(le,{variant:"outline",size:"icon",onClick:()=>u({open:!0,field:"registryPath",type:"file"}),title:"Browse...",children:n.jsx(si,{className:"w-4 h-4"})})]})]})]})]}),n.jsxs("div",{className:"border-b border-border pb-6",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(h5,{className:"w-4 h-4"}),"User Interface"]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Default Port"}),n.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Port for the web UI server"}),n.jsx(ct,{type:"number",value:((z=e==null?void 0:e.ui)==null?void 0:z.port)||3333,onChange:G=>W("ui","port",parseInt(G.target.value)||3333),placeholder:"3333",className:"w-32"})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Open Browser on Start"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Automatically open browser when starting the UI"})]}),n.jsx(dt,{checked:((K=e==null?void 0:e.ui)==null?void 0:K.openBrowser)??!0,onCheckedChange:G=>W("ui","openBrowser",G)})]})]})]}),n.jsxs("div",{className:"border-b border-border pb-6",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(rM,{className:"w-4 h-4"}),"AI Assistant"]}),n.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Choose which AI assistant to use for features like MCP creation and tool import."}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg cursor-pointer border-2 transition-colors ${((e==null?void 0:e.aiAssistant)||"claude")==="claude"?"border-orange-500 bg-orange-500/5":"border-transparent bg-muted/50 hover:bg-muted"}`,onClick:()=>$("aiAssistant","claude"),children:[n.jsx("input",{type:"radio",name:"aiAssistant",value:"claude",checked:((e==null?void 0:e.aiAssistant)||"claude")==="claude",onChange:()=>$("aiAssistant","claude"),className:"sr-only"}),n.jsx("div",{className:"w-8 h-8 rounded-md bg-orange-500/10 flex items-center justify-center",children:n.jsx(Ht,{className:"w-4 h-4 text-orange-500"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Claude Code"}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Anthropic's AI coding assistant • Command: ",n.jsx("code",{className:"text-xs",children:"claude"})]})]}),((e==null?void 0:e.aiAssistant)||"claude")==="claude"&&n.jsx("div",{className:"w-2 h-2 rounded-full bg-orange-500"})]}),n.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg cursor-pointer border-2 transition-colors ${(e==null?void 0:e.aiAssistant)==="gemini"?"border-blue-500 bg-blue-500/5":"border-transparent bg-muted/50 hover:bg-muted"}`,onClick:()=>$("aiAssistant","gemini"),children:[n.jsx("input",{type:"radio",name:"aiAssistant",value:"gemini",checked:(e==null?void 0:e.aiAssistant)==="gemini",onChange:()=>$("aiAssistant","gemini"),className:"sr-only"}),n.jsx("div",{className:"w-8 h-8 rounded-md bg-blue-500/10 flex items-center justify-center",children:n.jsx(Ft,{className:"w-4 h-4 text-blue-500"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Gemini CLI"}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Google's AI coding assistant • Command: ",n.jsx("code",{className:"text-xs",children:"gemini"})]})]}),(e==null?void 0:e.aiAssistant)==="gemini"&&n.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500"})]})]})]}),n.jsxs("div",{className:"border-b border-border pb-6",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(kM,{className:"w-4 h-4"}),"Enabled AI Tools"]}),n.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Select which AI coding tools to generate MCP configurations for. The Apply button will update all enabled tools."}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-md bg-orange-500/10 flex items-center justify-center",children:n.jsx(Ht,{className:"w-4 h-4 text-orange-500"})}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Claude Code"}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Anthropic's AI coding assistant • Output: ",n.jsx("code",{className:"text-xs",children:".mcp.json"})]})]})]}),n.jsx(dt,{checked:((e==null?void 0:e.enabledTools)||["claude"]).includes("claude"),onCheckedChange:()=>Y("claude")})]}),n.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-md bg-blue-500/10 flex items-center justify-center",children:n.jsx(Ht,{className:"w-4 h-4 text-blue-500"})}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Gemini CLI"}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Google's terminal AI coding assistant • Output: ",n.jsx("code",{className:"text-xs",children:"~/.gemini/settings.json"})]})]})]}),n.jsx(dt,{checked:((e==null?void 0:e.enabledTools)||["claude"]).includes("gemini"),onCheckedChange:()=>Y("gemini")})]}),n.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-md bg-purple-500/10 flex items-center justify-center",children:n.jsx(Ht,{className:"w-4 h-4 text-purple-500"})}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Antigravity"}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Google's AI IDE • Output: ",n.jsx("code",{className:"text-xs",children:"~/.gemini/antigravity/mcp_config.json"})]})]})]}),n.jsx(dt,{checked:((e==null?void 0:e.enabledTools)||["claude"]).includes("antigravity"),onCheckedChange:()=>Y("antigravity")})]}),n.jsxs("p",{className:"text-xs text-muted-foreground italic",children:["Note: Antigravity does not support environment variable interpolation (",n.jsx("code",{children:"${VAR}"}),"). Variables are resolved to actual values when generating its config."]})]})]}),v.length>0&&n.jsxs("div",{children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(w1,{className:"w-4 h-4"}),"Hidden Sub-projects"]}),n.jsx("div",{className:"space-y-2",children:v.map(G=>n.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(wr,{className:"w-4 h-4 text-muted-foreground"}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-foreground",children:G.name}),n.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:G.dir.replace(k+"/","")})]})]}),n.jsxs(le,{size:"sm",variant:"outline",onClick:()=>T(G.dir),className:"h-7",children:[n.jsx(_1,{className:"w-3 h-3 mr-1"}),"Unhide"]})]},G.dir))})]}),n.jsxs("div",{children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(Cr,{className:"w-4 h-4"}),"About"]}),n.jsxs("div",{className:"bg-muted rounded-lg p-4 space-y-3",children:[n.jsxs("div",{className:"flex justify-between text-sm",children:[n.jsx("span",{className:"text-muted-foreground",children:"Installed Version"}),n.jsx("span",{className:"font-medium font-mono text-foreground",children:(m==null?void 0:m.installedVersion)||"Loading..."})]}),(m==null?void 0:m.updateAvailable)&&n.jsx("div",{className:"p-3 bg-green-500/10 border border-green-500/20 rounded-lg",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:"Update Available!"}),n.jsxs("p",{className:"text-xs text-green-600/80 dark:text-green-400/80",children:["Version ",m.latestVersion," via ",m.updateMethod==="npm"?"npm":m.sourcePath]})]}),n.jsxs(le,{size:"sm",onClick:N,disabled:x,className:"bg-green-600 hover:bg-green-700 text-white",children:[x?n.jsx(ut,{className:"w-4 h-4 mr-2 animate-spin"}):n.jsx(bl,{className:"w-4 h-4 mr-2"}),"Update Now"]})]})}),!(m!=null&&m.updateAvailable)&&(m==null?void 0:m.latestVersion)&&n.jsxs("div",{className:"flex justify-between text-sm",children:[n.jsx("span",{className:"text-muted-foreground",children:"Latest Version"}),n.jsxs("span",{className:"font-mono text-green-600 dark:text-green-400",children:[m.latestVersion," ✓"]})]}),(m==null?void 0:m.sourcePath)&&!(m!=null&&m.updateAvailable)&&n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsx("span",{className:"text-muted-foreground",children:"Dev Source"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("code",{className:"text-xs text-muted-foreground",children:m.sourcePath}),n.jsx(le,{size:"sm",variant:"outline",onClick:N,disabled:x,className:"h-7",children:x?n.jsx(ut,{className:"w-3 h-3 animate-spin"}):n.jsx(pr,{className:"w-3 h-3"})})]})]}),n.jsxs("div",{className:"flex justify-between text-sm",children:[n.jsx("span",{className:"text-muted-foreground",children:"Install Location"}),n.jsx("code",{className:"text-xs text-muted-foreground",children:(m==null?void 0:m.installDir)||"~/.claude-config"})]}),n.jsxs("div",{className:"border-t border-border pt-3 mt-3 space-y-2",children:[n.jsxs("div",{className:"flex justify-between text-sm",children:[n.jsx("span",{className:"text-muted-foreground",children:"Documentation"}),n.jsx("a",{href:"https://github.com/regression-io/claude-config",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"GitHub"})]}),n.jsxs("div",{className:"flex justify-between text-sm",children:[n.jsx("span",{className:"text-muted-foreground",children:"What's New"}),n.jsxs("button",{onClick:R,className:"text-primary hover:underline flex items-center gap-1",children:[n.jsx(Am,{className:"w-3 h-3"}),"Changelog"]})]}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["After updating, restart the server with ",n.jsx("code",{className:"bg-muted-foreground/10 px-1 rounded",children:"claude-config ui"})]})]})]})]})]})]}),n.jsx(_g,{open:o.open,onOpenChange:G=>u(U=>({...U,open:G})),onSelect:G=>{if(o.field==="toolsDirs"){const U=(e==null?void 0:e.toolsDirs)||(e!=null&&e.toolsDir?[e.toolsDir]:[]);if(o.index===-1)t(L=>{const{toolsDir:M,...B}=L;return{...B,toolsDirs:[...U,G]}});else{const L=[...U];L[o.index]=G,t(M=>{const{toolsDir:B,...q}=M;return{...q,toolsDirs:L}})}}else o.field&&$(o.field,G)},type:o.type,initialPath:o.field==="toolsDirs"&&o.index>=0?((e==null?void 0:e.toolsDirs)||(e!=null&&e.toolsDir?[e.toolsDir]:[]))[o.index]||"~":(e==null?void 0:e[o.field])||"~",title:o.type==="directory"?"Select Directory":"Select File"}),n.jsx(Tt,{open:g.open,onOpenChange:G=>y(U=>({...U,open:G})),children:n.jsxs(St,{className:"max-w-2xl max-h-[80vh] flex flex-col overflow-hidden",children:[n.jsx(Ct,{className:"flex-shrink-0",children:n.jsxs(kt,{className:"flex items-center gap-2",children:[n.jsx(Am,{className:"w-5 h-5"}),"Changelog"]})}),g.loading?n.jsx("div",{className:"flex items-center justify-center py-12",children:n.jsx(ut,{className:"w-6 h-6 animate-spin text-primary"})}):n.jsx(Nn,{className:"h-[60vh]",children:n.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none pr-4",children:n.jsx(vz,{components:{h1:({children:G})=>n.jsx("h1",{className:"text-xl font-bold text-foreground mb-4",children:G}),h2:({children:G})=>n.jsx("h2",{className:"text-lg font-semibold text-foreground mt-6 mb-3 pb-2 border-b border-border",children:G}),h3:({children:G})=>n.jsx("h3",{className:"text-base font-medium text-foreground mt-4 mb-2",children:G}),p:({children:G})=>n.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:G}),ul:({children:G})=>n.jsx("ul",{className:"text-sm text-muted-foreground list-disc pl-5 mb-3 space-y-1",children:G}),li:({children:G})=>n.jsx("li",{className:"text-sm",children:G}),code:({children:G})=>n.jsx("code",{className:"bg-muted px-1 py-0.5 rounded text-xs font-mono",children:G}),hr:()=>n.jsx("hr",{className:"my-4 border-border"}),strong:({children:G})=>n.jsx("strong",{className:"font-semibold text-foreground",children:G})},children:g.content})})})]})})]})}function Cz(){const[e,t]=C.useState(null),[r,s]=C.useState({}),[o,u]=C.useState(!0);C.useEffect(()=>{d()},[]);const d=async()=>{try{u(!0);const[c,f]=await Promise.all([ke.getClaudeSettings(),ke.getRegistry()]);t(c.settings),s(f.mcpServers||{})}catch(c){console.error("Failed to load Claude settings:",c)}finally{u(!1)}},l=async c=>{try{await ke.saveClaudeSettings(c),t(c),ee.success("Claude Code settings saved!")}catch(f){ee.error("Failed to save settings: "+f.message)}};return o?n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx(ut,{className:"w-8 h-8 animate-spin text-indigo-600"})}):n.jsxs("div",{className:"space-y-6",children:[n.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-6 shadow-sm",children:n.jsx(Tj,{settings:e,onSave:l,loading:o,settingsPath:"~/.claude/settings.json",mcpServers:r})}),n.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[n.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),n.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[n.jsx("p",{children:"claude-config init # Initialize project"}),n.jsx("p",{children:"claude-config apply # Generate .mcp.json from config"}),n.jsx("p",{children:"claude-config show # Show current project config"})]})]})]})}function kz(){const[e,t]=C.useState(null),[r,s]=C.useState(!0);C.useEffect(()=>{o()},[]);const o=async()=>{try{s(!0);const d=await ke.getGeminiSettings();t(d.settings)}catch(d){console.error("Failed to load Gemini settings:",d)}finally{s(!1)}},u=async d=>{try{await ke.saveGeminiSettings(d),t(d),ee.success("Gemini CLI settings saved!")}catch(l){ee.error("Failed to save settings: "+l.message)}};return r?n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx(ut,{className:"w-8 h-8 animate-spin text-blue-600"})}):n.jsxs("div",{className:"space-y-6",children:[n.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-6 shadow-sm",children:n.jsx(Rj,{settings:e,onSave:u,loading:r,settingsPath:"~/.gemini/settings.json"})}),n.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[n.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),n.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[n.jsx("p",{children:"claude-config apply # Generate settings for all tools"}),n.jsx("p",{children:"claude-config apply --gemini # Generate Gemini settings only"})]})]})]})}const jz=[{id:"off",name:"Off",description:"Never auto-execute; requires allow list"},{id:"auto",name:"Auto",description:"Safety model determines execution"},{id:"turbo",name:"Turbo",description:"Auto-execute unless in deny list",dangerous:!0}],Nz=[{id:"always-proceed",name:"Always Proceed",description:"Agent never requests review"},{id:"agent-decides",name:"Agent Decides",description:"Agent determines when review is needed"},{id:"request-review",name:"Request Review",description:"Agent always requests review"}],Ez=[{id:"always-proceed",name:"Always Proceed",description:"Maximum autonomy",dangerous:!0},{id:"request-review",name:"Request Review",description:"Ask before browser JavaScript"},{id:"disabled",name:"Disabled",description:"Never run browser JavaScript"}];function Pz({settings:e,onSave:t,loading:r,settingsPath:s}){const[o,u]=C.useState(e||{}),[d,l]=C.useState(!1),[c,f]=C.useState("rich"),[m,h]=C.useState(JSON.stringify(e||{},null,2)),[x,w]=C.useState({open:!1,name:"",json:""}),[k,_]=C.useState({}),v=async()=>{l(!0);try{if(c==="json")try{const T=JSON.parse(m);await t(T),u(T)}catch{ee.error("Invalid JSON"),l(!1);return}else await t(o),h(JSON.stringify(o,null,2));ee.success("Settings saved")}finally{l(!1)}},b=(T,N)=>{u(R=>({...R,[T]:N}))},g=(T,N)=>(o==null?void 0:o[T])??N,y=o.mcpServers||{},j=()=>{const{name:T,json:N}=x;if(!T.trim()){ee.error("Please enter a name for the MCP");return}let R;try{R=JSON.parse(N)}catch{ee.error("Invalid JSON configuration");return}if(!R.command){ee.error('MCP config must have a "command" field');return}u(I=>({...I,mcpServers:{...I.mcpServers,[T.trim()]:R}})),w({open:!1,name:"",json:""}),ee.success(`Added MCP: ${T}`)},E=T=>{u(N=>{const{[T]:R,...I}=N.mcpServers||{};return{...N,mcpServers:I}}),ee.success(`Removed MCP: ${T}`)},P=T=>{_(N=>({...N,[T]:!N[T]}))};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-500/10 flex items-center justify-center",children:n.jsx(wl,{className:"w-5 h-5 text-purple-500"})}),n.jsxs("div",{children:[n.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:["Antigravity Settings",n.jsx(Qe,{variant:"outline",className:"text-xs font-normal text-purple-600 border-purple-300 dark:border-purple-700",children:"Google"})]}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Stored in: ",n.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs",children:s})]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("div",{className:"flex bg-muted rounded-lg p-1",children:[n.jsx("button",{className:`px-3 py-1 text-sm rounded-md transition-colors ${c==="rich"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>f("rich"),children:"Settings"}),n.jsx("button",{className:`px-3 py-1 text-sm rounded-md transition-colors ${c==="json"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>{h(JSON.stringify(o,null,2)),f("json")},children:"JSON"})]}),n.jsxs(le,{onClick:v,disabled:d||r,children:[d?n.jsx(ut,{className:"w-4 h-4 mr-2 animate-spin"}):n.jsx(ui,{className:"w-4 h-4 mr-2"}),"Save"]})]})]}),c==="json"?n.jsx("div",{className:"border border-border rounded-lg bg-card overflow-hidden",children:n.jsx(pt,{value:m,onChange:T=>h(T.target.value),className:"font-mono text-sm min-h-[500px] border-0 rounded-none resize-none",placeholder:"{ }"})}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(as,{className:"w-4 h-4 text-purple-500"}),"Security Policies"]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Terminal Command Execution"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Control how the agent executes shell commands"})]}),n.jsxs(fr,{value:g("terminalPolicy","auto"),onValueChange:T=>b("terminalPolicy",T),children:[n.jsx(ar,{className:"w-44",children:n.jsx(mr,{})}),n.jsx(lr,{children:jz.map(T=>n.jsx(xt,{value:T.id,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{children:T.name}),T.dangerous&&n.jsx(Qe,{variant:"destructive",className:"text-xs",children:"Risk"})]})},T.id))})]})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Review Policy"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"When the agent should request human review"})]}),n.jsxs(fr,{value:g("reviewPolicy","agent-decides"),onValueChange:T=>b("reviewPolicy",T),children:[n.jsx(ar,{className:"w-44",children:n.jsx(mr,{})}),n.jsx(lr,{children:Nz.map(T=>n.jsx(xt,{value:T.id,children:T.name},T.id))})]})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"JavaScript Execution"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Control browser JavaScript execution"})]}),n.jsxs(fr,{value:g("jsPolicy","request-review"),onValueChange:T=>b("jsPolicy",T),children:[n.jsx(ar,{className:"w-44",children:n.jsx(mr,{})}),n.jsx(lr,{children:Ez.map(T=>n.jsx(xt,{value:T.id,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{children:T.name}),T.dangerous&&n.jsx(Qe,{variant:"destructive",className:"text-xs",children:"Risk"})]})},T.id))})]})]})]})]}),n.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[n.jsx(Fn,{className:"w-4 h-4 text-purple-500"}),"MCP Servers",n.jsx(Qe,{variant:"secondary",className:"text-xs",children:Object.keys(y).length})]}),n.jsxs(le,{size:"sm",variant:"outline",onClick:()=>w({open:!0,name:"",json:`{
|
|
582
|
+
`},o),u}function K$(e,t){return e&&"run"in e?async function(r,s){const o=kw(r,{file:s,...t});await e.run(o,s)}:function(r,s){return kw(r,{file:s,...e||t})}}function jw(e){if(e)throw e}var nm,Nw;function q$(){if(Nw)return nm;Nw=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Object.defineProperty,s=Object.getOwnPropertyDescriptor,o=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},u=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var m=e.call(f,"constructor"),h=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!m&&!h)return!1;var x;for(x in f);return typeof x>"u"||e.call(f,x)},d=function(f,m){r&&m.name==="__proto__"?r(f,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):f[m.name]=m.newValue},l=function(f,m){if(m==="__proto__")if(e.call(f,m)){if(s)return s(f,m).value}else return;return f[m]};return nm=function c(){var f,m,h,x,w,k,_=arguments[0],v=1,b=arguments.length,g=!1;for(typeof _=="boolean"&&(g=_,_=arguments[1]||{},v=2),(_==null||typeof _!="object"&&typeof _!="function")&&(_={});v<b;++v)if(f=arguments[v],f!=null)for(m in f)h=l(_,m),x=l(f,m),_!==x&&(g&&x&&(u(x)||(w=o(x)))?(w?(w=!1,k=h&&o(h)?h:[]):k=h&&u(h)?h:{},d(_,{name:m,newValue:c(g,k,x)})):typeof x<"u"&&d(_,{name:m,newValue:x}));return _},nm}var Y$=q$();const sm=ml(Y$);function sp(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function X$(){const e=[],t={run:r,use:s};return t;function r(...o){let u=-1;const d=o.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);l(null,...o);function l(c,...f){const m=e[++u];let h=-1;if(c){d(c);return}for(;++h<o.length;)(f[h]===null||f[h]===void 0)&&(f[h]=o[h]);o=f,m?J$(m,l)(...f):d(null,...f)}}function s(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function J$(e,t){let r;return s;function s(...d){const l=e.length>d.length;let c;l&&d.push(o);try{c=e.apply(this,d)}catch(f){const m=f;if(l&&r)throw m;return o(m)}l||(c&&c.then&&typeof c.then=="function"?c.then(u,o):c instanceof Error?o(c):u(c))}function o(d,...l){r||(r=!0,t(d,...l))}function u(d){o(null,d)}}const Yn={basename:Q$,dirname:Z$,extname:ez,join:tz,sep:"/"};function Q$(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ol(e);let r=0,s=-1,o=e.length,u;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(u){r=o+1;break}}else s<0&&(u=!0,s=o+1);return s<0?"":e.slice(r,s)}if(t===e)return"";let d=-1,l=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(u){r=o+1;break}}else d<0&&(u=!0,d=o+1),l>-1&&(e.codePointAt(o)===t.codePointAt(l--)?l<0&&(s=o):(l=-1,s=d));return r===s?s=d:s<0&&(s=e.length),e.slice(r,s)}function Z$(e){if(Ol(e),e.length===0)return".";let t=-1,r=e.length,s;for(;--r;)if(e.codePointAt(r)===47){if(s){t=r;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function ez(e){Ol(e);let t=e.length,r=-1,s=0,o=-1,u=0,d;for(;t--;){const l=e.codePointAt(t);if(l===47){if(d){s=t+1;break}continue}r<0&&(d=!0,r=t+1),l===46?o<0?o=t:u!==1&&(u=1):o>-1&&(u=-1)}return o<0||r<0||u===0||u===1&&o===r-1&&o===s+1?"":e.slice(o,r)}function tz(...e){let t=-1,r;for(;++t<e.length;)Ol(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":rz(r)}function rz(e){Ol(e);const t=e.codePointAt(0)===47;let r=nz(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function nz(e,t){let r="",s=0,o=-1,u=0,d=-1,l,c;for(;++d<=e.length;){if(d<e.length)l=e.codePointAt(d);else{if(l===47)break;l=47}if(l===47){if(!(o===d-1||u===1))if(o!==d-1&&u===2){if(r.length<2||s!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(c=r.lastIndexOf("/"),c!==r.length-1){c<0?(r="",s=0):(r=r.slice(0,c),s=r.length-1-r.lastIndexOf("/")),o=d,u=0;continue}}else if(r.length>0){r="",s=0,o=d,u=0;continue}}t&&(r=r.length>0?r+"/..":"..",s=2)}else r.length>0?r+="/"+e.slice(o+1,d):r=e.slice(o+1,d),s=d-o-1;o=d,u=0}else l===46&&u>-1?u++:u=-1}return r}function Ol(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const sz={cwd:iz};function iz(){return"/"}function ip(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function oz(e){if(typeof e=="string")e=new URL(e);else if(!ip(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return az(e)}function az(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const s=t.codePointAt(r+2);if(s===70||s===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const im=["history","path","basename","stem","extname","dirname"];class v2{constructor(t){let r;t?ip(t)?r={path:t}:typeof t=="string"||lz(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":sz.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<im.length;){const u=im[s];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let o;for(o in r)im.includes(o)||(this[o]=r[o])}get basename(){return typeof this.path=="string"?Yn.basename(this.path):void 0}set basename(t){am(t,"basename"),om(t,"basename"),this.path=Yn.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Yn.dirname(this.path):void 0}set dirname(t){Ew(this.basename,"dirname"),this.path=Yn.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Yn.extname(this.path):void 0}set extname(t){if(om(t,"extname"),Ew(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Yn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ip(t)&&(t=oz(t)),am(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Yn.basename(this.path,this.extname):void 0}set stem(t){am(t,"stem"),om(t,"stem"),this.path=Yn.join(this.dirname||"",t+(this.extname||""))}fail(t,r,s){const o=this.message(t,r,s);throw o.fatal=!0,o}info(t,r,s){const o=this.message(t,r,s);return o.fatal=void 0,o}message(t,r,s){const o=new Dr(t,r,s);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function om(e,t){if(e&&e.includes(Yn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Yn.sep+"`")}function am(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Ew(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function lz(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const cz=(function(e){const s=this.constructor.prototype,o=s[e],u=function(){return o.apply(u,arguments)};return Object.setPrototypeOf(u,s),u}),uz={}.hasOwnProperty;class Yg extends cz{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=X$()}copy(){const t=new Yg;let r=-1;for(;++r<this.attachers.length;){const s=this.attachers[r];t.use(...s)}return t.data(sm(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(um("data",this.frozen),this.namespace[t]=r,this):uz.call(this.namespace,t)&&this.namespace[t]||void 0:t?(um("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const o=r.call(t,...s);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=ou(t),s=this.parser||this.Parser;return lm("parse",s),s(String(r),r)}process(t,r){const s=this;return this.freeze(),lm("process",this.parser||this.Parser),cm("process",this.compiler||this.Compiler),r?o(void 0,r):new Promise(o);function o(u,d){const l=ou(t),c=s.parse(l);s.run(c,l,function(m,h,x){if(m||!h||!x)return f(m);const w=h,k=s.stringify(w,x);fz(k)?x.value=k:x.result=k,f(m,x)});function f(m,h){m||!h?d(m):u?u(h):r(void 0,h)}}}processSync(t){let r=!1,s;return this.freeze(),lm("processSync",this.parser||this.Parser),cm("processSync",this.compiler||this.Compiler),this.process(t,o),Aw("processSync","process",r),s;function o(u,d){r=!0,jw(u),s=d}}run(t,r,s){Pw(t),this.freeze();const o=this.transformers;return!s&&typeof r=="function"&&(s=r,r=void 0),s?u(void 0,s):new Promise(u);function u(d,l){const c=ou(r);o.run(t,c,f);function f(m,h,x){const w=h||t;m?l(m):d?d(w):s(void 0,w,x)}}}runSync(t,r){let s=!1,o;return this.run(t,r,u),Aw("runSync","run",s),o;function u(d,l){jw(d),o=l,s=!0}}stringify(t,r){this.freeze();const s=ou(r),o=this.compiler||this.Compiler;return cm("stringify",o),Pw(t),o(t,s)}use(t,...r){const s=this.attachers,o=this.namespace;if(um("use",this.frozen),t!=null)if(typeof t=="function")c(t,r);else if(typeof t=="object")Array.isArray(t)?l(t):d(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function u(f){if(typeof f=="function")c(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[m,...h]=f;c(m,h)}else d(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function d(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(f.plugins),f.settings&&(o.settings=sm(!0,o.settings,f.settings))}function l(f){let m=-1;if(f!=null)if(Array.isArray(f))for(;++m<f.length;){const h=f[m];u(h)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function c(f,m){let h=-1,x=-1;for(;++h<s.length;)if(s[h][0]===f){x=h;break}if(x===-1)s.push([f,...m]);else if(m.length>0){let[w,...k]=m;const _=s[x][1];sp(_)&&sp(w)&&(w=sm(!0,_,w)),s[x]=[f,w,...k]}}}}const dz=new Yg().freeze();function lm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function cm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function um(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Pw(e){if(!sp(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Aw(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ou(e){return hz(e)?e:new v2(e)}function hz(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function fz(e){return typeof e=="string"||mz(e)}function mz(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const pz="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Tw=[],Rw={allowDangerousHtml:!0},gz=/^(https?|ircs?|mailto|xmpp)$/i,xz=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function vz(e){const t=yz(e),r=bz(e);return wz(t.runSync(t.parse(r),r),e)}function yz(e){const t=e.rehypePlugins||Tw,r=e.remarkPlugins||Tw,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Rw}:Rw;return dz().use(Q9).use(r).use(K$,s).use(t)}function bz(e){const t=e.children||"",r=new v2;return typeof t=="string"&&(r.value=t),r}function wz(e,t){const r=t.allowedElements,s=t.allowElement,o=t.components,u=t.disallowedElements,d=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||_z;for(const m of xz)Object.hasOwn(t,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+pz+m.id,void 0);return x2(e,f),T8(e,{Fragment:n.Fragment,components:o,ignoreInvalidStyle:!0,jsx:n.jsx,jsxs:n.jsxs,passKeys:!0,passNode:!0});function f(m,h,x){if(m.type==="raw"&&x&&typeof h=="number")return d?x.children.splice(h,1):x.children[h]={type:"text",value:m.value},h;if(m.type==="element"){let w;for(w in em)if(Object.hasOwn(em,w)&&Object.hasOwn(m.properties,w)){const k=m.properties[w],_=em[w];(_===null||_.includes(m.tagName))&&(m.properties[w]=c(String(k||""),w,m))}}if(m.type==="element"){let w=r?!r.includes(m.tagName):u?u.includes(m.tagName):!1;if(!w&&s&&typeof h=="number"&&(w=!s(m,h,x)),w&&x&&typeof h=="number")return l&&m.children?x.children.splice(h,1,...m.children):x.children.splice(h,1),h}}}function _z(e){const t=e.indexOf(":"),r=e.indexOf("?"),s=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||r!==-1&&t>r||s!==-1&&t>s||gz.test(e.slice(0,t))?e:""}function Sz(){var z,K;const[e,t]=C.useState(null),[r,s]=C.useState(""),[o,u]=C.useState({open:!1,field:null,type:"directory"}),[d,l]=C.useState(!0),[c,f]=C.useState(!1),[m,h]=C.useState(null),[x,w]=C.useState(!1),[k,_]=C.useState(null),[v,b]=C.useState([]),[g,y]=C.useState({open:!1,content:"",loading:!1});C.useEffect(()=>{I(),j(),E()},[]);const j=async()=>{try{const G=await ke.checkVersion();h(G)}catch(G){console.error("Failed to load version info:",G)}},E=async()=>{try{const G=await ke.getProject();_(G.dir),P(G.dir)}catch(G){console.error("Failed to load project info:",G)}},P=async G=>{if(G)try{const U=await ke.getHiddenSubprojects(G);b(U.hidden||[])}catch(U){console.error("Failed to load hidden sub-projects:",U)}},T=async G=>{if(k)try{const U=await ke.unhideSubproject(k,G);U.success?(ee.success("Sub-project unhidden"),P(k)):ee.error(U.error||"Failed to unhide")}catch(U){ee.error("Failed to unhide: "+U.message)}},N=async()=>{var G;if(!(m!=null&&m.updateAvailable)){ee.error("No update available");return}w(!0);try{const U=await ke.performUpdate({updateMethod:m.updateMethod,sourcePath:m.sourcePath});U.success?(U.updateMethod==="npm"?ee.success(U.message||"Updated via npm! Restart the server to apply."):ee.success(`Updated! Files: ${((G=U.updated)==null?void 0:G.join(", "))||"all"}. Restart the server to apply.`),j()):ee.error("Update failed: "+U.error)}catch(U){ee.error("Update failed: "+U.message)}finally{w(!1)}},R=async()=>{y(G=>({...G,open:!0,loading:!0}));try{const G=await ke.getChangelog();G.success?y(U=>({...U,content:G.content,loading:!1})):(ee.error("Failed to load changelog"),y(U=>({...U,open:!1,loading:!1})))}catch(G){ee.error("Failed to load changelog: "+G.message),y(U=>({...U,open:!1,loading:!1}))}},I=async()=>{try{l(!0);const G=await ke.getConfig();t(G.config),s(G.path)}catch{ee.error("Failed to load settings")}finally{l(!1)}},O=async()=>{f(!0);try{await ke.saveConfig(e),ee.success("Preferences saved!")}catch{ee.error("Failed to save preferences")}finally{f(!1)}},$=(G,U)=>{t(L=>({...L,[G]:U}))},W=(G,U,L)=>{t(M=>({...M,[G]:{...M[G],[U]:L}}))},Y=async G=>{const U=(e==null?void 0:e.enabledTools)||["claude"];let L;if(U.includes(G)){if(U.length<=1){ee.error("At least one tool must be enabled");return}L=U.filter(B=>B!==G)}else L=[...U,G];const M={...e,enabledTools:L};t(M);try{await ke.saveConfig(M),ee.success(`${G==="claude"?"Claude Code":G==="gemini"?"Gemini CLI":"Antigravity"} ${L.includes(G)?"enabled":"disabled"}`)}catch{t(e),ee.error("Failed to save preference")}};return d?n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx(ut,{className:"w-8 h-8 animate-spin text-primary"})}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-lg bg-muted flex items-center justify-center",children:n.jsx(A1,{className:"w-5 h-5 text-muted-foreground"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"coder-config Preferences"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"Tool settings for this configuration manager"})]})]}),n.jsxs("div",{className:"bg-card rounded-xl border border-border p-6 shadow-sm",children:[n.jsxs("div",{className:"flex items-center justify-between mb-6",children:[n.jsx("div",{children:n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Stored in: ",n.jsx("code",{className:"bg-muted px-2 py-0.5 rounded",children:r})]})}),n.jsxs(le,{onClick:O,disabled:c,children:[c?n.jsx(ut,{className:"w-4 h-4 mr-2 animate-spin"}):n.jsx(ui,{className:"w-4 h-4 mr-2"}),"Save"]})]}),n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"border-b border-border pb-6",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(wr,{className:"w-4 h-4"}),"Directories"]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"MCP Tools Directories"}),n.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Folders containing local MCP tool repositories for discovery"}),n.jsxs("div",{className:"space-y-2",children:[((e==null?void 0:e.toolsDirs)||(e!=null&&e.toolsDir?[e.toolsDir]:[])).map((G,U)=>n.jsxs("div",{className:"flex gap-2",children:[n.jsx(ct,{value:G||"",onChange:L=>{const M=[...(e==null?void 0:e.toolsDirs)||(e!=null&&e.toolsDir?[e.toolsDir]:[])];M[U]=L.target.value,$("toolsDirs",M),e!=null&&e.toolsDir&&t(B=>{const{toolsDir:q,...F}=B;return{...F,toolsDirs:M}})},placeholder:"~/mcp-tools",className:"font-mono flex-1"}),n.jsx(le,{variant:"outline",size:"icon",onClick:()=>u({open:!0,field:"toolsDirs",type:"directory",index:U}),title:"Browse...",children:n.jsx(si,{className:"w-4 h-4"})}),n.jsx(le,{variant:"outline",size:"icon",onClick:()=>{const M=((e==null?void 0:e.toolsDirs)||(e!=null&&e.toolsDir?[e.toolsDir]:[])).filter((B,q)=>q!==U);t(B=>{const{toolsDir:q,...F}=B;return{...F,toolsDirs:M.length>0?M:void 0}})},title:"Remove",className:"text-destructive hover:text-destructive",children:n.jsx(ei,{className:"w-4 h-4"})})]},U)),n.jsxs(le,{variant:"outline",size:"sm",onClick:()=>u({open:!0,field:"toolsDirs",type:"directory",index:-1}),className:"mt-2",children:[n.jsx(Mi,{className:"w-4 h-4 mr-2"}),"Add Tools Folder"]})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Global Registry Path"}),n.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Path to the global MCP registry file"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(ct,{value:(e==null?void 0:e.registryPath)||"",onChange:G=>$("registryPath",G.target.value),placeholder:"~/.claude/registry.json",className:"font-mono flex-1"}),n.jsx(le,{variant:"outline",size:"icon",onClick:()=>u({open:!0,field:"registryPath",type:"file"}),title:"Browse...",children:n.jsx(si,{className:"w-4 h-4"})})]})]})]})]}),n.jsxs("div",{className:"border-b border-border pb-6",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(h5,{className:"w-4 h-4"}),"User Interface"]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Default Port"}),n.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Port for the web UI server"}),n.jsx(ct,{type:"number",value:((z=e==null?void 0:e.ui)==null?void 0:z.port)||3333,onChange:G=>W("ui","port",parseInt(G.target.value)||3333),placeholder:"3333",className:"w-32"})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Open Browser on Start"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Automatically open browser when starting the UI"})]}),n.jsx(dt,{checked:((K=e==null?void 0:e.ui)==null?void 0:K.openBrowser)??!0,onCheckedChange:G=>W("ui","openBrowser",G)})]})]})]}),n.jsxs("div",{className:"border-b border-border pb-6",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(rM,{className:"w-4 h-4"}),"AI Assistant"]}),n.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Choose which AI assistant to use for features like MCP creation and tool import."}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg cursor-pointer border-2 transition-colors ${((e==null?void 0:e.aiAssistant)||"claude")==="claude"?"border-orange-500 bg-orange-500/5":"border-transparent bg-muted/50 hover:bg-muted"}`,onClick:()=>$("aiAssistant","claude"),children:[n.jsx("input",{type:"radio",name:"aiAssistant",value:"claude",checked:((e==null?void 0:e.aiAssistant)||"claude")==="claude",onChange:()=>$("aiAssistant","claude"),className:"sr-only"}),n.jsx("div",{className:"w-8 h-8 rounded-md bg-orange-500/10 flex items-center justify-center",children:n.jsx(Ht,{className:"w-4 h-4 text-orange-500"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Claude Code"}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Anthropic's AI coding assistant • Command: ",n.jsx("code",{className:"text-xs",children:"claude"})]})]}),((e==null?void 0:e.aiAssistant)||"claude")==="claude"&&n.jsx("div",{className:"w-2 h-2 rounded-full bg-orange-500"})]}),n.jsxs("label",{className:`flex items-center gap-3 p-3 rounded-lg cursor-pointer border-2 transition-colors ${(e==null?void 0:e.aiAssistant)==="gemini"?"border-blue-500 bg-blue-500/5":"border-transparent bg-muted/50 hover:bg-muted"}`,onClick:()=>$("aiAssistant","gemini"),children:[n.jsx("input",{type:"radio",name:"aiAssistant",value:"gemini",checked:(e==null?void 0:e.aiAssistant)==="gemini",onChange:()=>$("aiAssistant","gemini"),className:"sr-only"}),n.jsx("div",{className:"w-8 h-8 rounded-md bg-blue-500/10 flex items-center justify-center",children:n.jsx(Ft,{className:"w-4 h-4 text-blue-500"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("span",{className:"text-sm font-medium text-foreground",children:"Gemini CLI"}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Google's AI coding assistant • Command: ",n.jsx("code",{className:"text-xs",children:"gemini"})]})]}),(e==null?void 0:e.aiAssistant)==="gemini"&&n.jsx("div",{className:"w-2 h-2 rounded-full bg-blue-500"})]})]})]}),n.jsxs("div",{className:"border-b border-border pb-6",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(kM,{className:"w-4 h-4"}),"Enabled AI Tools"]}),n.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Select which AI coding tools to generate MCP configurations for. The Apply button will update all enabled tools."}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-md bg-orange-500/10 flex items-center justify-center",children:n.jsx(Ht,{className:"w-4 h-4 text-orange-500"})}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Claude Code"}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Anthropic's AI coding assistant • Output: ",n.jsx("code",{className:"text-xs",children:".mcp.json"})]})]})]}),n.jsx(dt,{checked:((e==null?void 0:e.enabledTools)||["claude"]).includes("claude"),onCheckedChange:()=>Y("claude")})]}),n.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-md bg-blue-500/10 flex items-center justify-center",children:n.jsx(Ht,{className:"w-4 h-4 text-blue-500"})}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Gemini CLI"}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Google's terminal AI coding assistant • Output: ",n.jsx("code",{className:"text-xs",children:"~/.gemini/settings.json"})]})]})]}),n.jsx(dt,{checked:((e==null?void 0:e.enabledTools)||["claude"]).includes("gemini"),onCheckedChange:()=>Y("gemini")})]}),n.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-md bg-purple-500/10 flex items-center justify-center",children:n.jsx(Ht,{className:"w-4 h-4 text-purple-500"})}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Antigravity"}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Google's AI IDE • Output: ",n.jsx("code",{className:"text-xs",children:"~/.gemini/antigravity/mcp_config.json"})]})]})]}),n.jsx(dt,{checked:((e==null?void 0:e.enabledTools)||["claude"]).includes("antigravity"),onCheckedChange:()=>Y("antigravity")})]}),n.jsxs("p",{className:"text-xs text-muted-foreground italic",children:["Note: Antigravity does not support environment variable interpolation (",n.jsx("code",{children:"${VAR}"}),"). Variables are resolved to actual values when generating its config."]})]})]}),v.length>0&&n.jsxs("div",{children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(w1,{className:"w-4 h-4"}),"Hidden Sub-projects"]}),n.jsx("div",{className:"space-y-2",children:v.map(G=>n.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(wr,{className:"w-4 h-4 text-muted-foreground"}),n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-foreground",children:G.name}),n.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:G.dir.replace(k+"/","")})]})]}),n.jsxs(le,{size:"sm",variant:"outline",onClick:()=>T(G.dir),className:"h-7",children:[n.jsx(_1,{className:"w-3 h-3 mr-1"}),"Unhide"]})]},G.dir))})]}),n.jsxs("div",{children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(Cr,{className:"w-4 h-4"}),"About"]}),n.jsxs("div",{className:"bg-muted rounded-lg p-4 space-y-3",children:[n.jsxs("div",{className:"flex justify-between text-sm",children:[n.jsx("span",{className:"text-muted-foreground",children:"Installed Version"}),n.jsx("span",{className:"font-medium font-mono text-foreground",children:(m==null?void 0:m.installedVersion)||"Loading..."})]}),(m==null?void 0:m.updateAvailable)&&n.jsx("div",{className:"p-3 bg-green-500/10 border border-green-500/20 rounded-lg",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:"Update Available!"}),n.jsxs("p",{className:"text-xs text-green-600/80 dark:text-green-400/80",children:["Version ",m.latestVersion," via ",m.updateMethod==="npm"?"npm":m.sourcePath]})]}),n.jsxs(le,{size:"sm",onClick:N,disabled:x,className:"bg-green-600 hover:bg-green-700 text-white",children:[x?n.jsx(ut,{className:"w-4 h-4 mr-2 animate-spin"}):n.jsx(bl,{className:"w-4 h-4 mr-2"}),"Update Now"]})]})}),!(m!=null&&m.updateAvailable)&&(m==null?void 0:m.latestVersion)&&n.jsxs("div",{className:"flex justify-between text-sm",children:[n.jsx("span",{className:"text-muted-foreground",children:"Latest Version"}),n.jsxs("span",{className:"font-mono text-green-600 dark:text-green-400",children:[m.latestVersion," ✓"]})]}),(m==null?void 0:m.sourcePath)&&!(m!=null&&m.updateAvailable)&&n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsx("span",{className:"text-muted-foreground",children:"Dev Source"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("code",{className:"text-xs text-muted-foreground",children:m.sourcePath}),n.jsx(le,{size:"sm",variant:"outline",onClick:N,disabled:x,className:"h-7",children:x?n.jsx(ut,{className:"w-3 h-3 animate-spin"}):n.jsx(pr,{className:"w-3 h-3"})})]})]}),n.jsxs("div",{className:"flex justify-between text-sm",children:[n.jsx("span",{className:"text-muted-foreground",children:"Install Location"}),n.jsx("code",{className:"text-xs text-muted-foreground",children:(m==null?void 0:m.installDir)||"~/.coder-config"})]}),n.jsxs("div",{className:"border-t border-border pt-3 mt-3 space-y-2",children:[n.jsxs("div",{className:"flex justify-between text-sm",children:[n.jsx("span",{className:"text-muted-foreground",children:"Documentation"}),n.jsx("a",{href:"https://github.com/regression-io/coder-config",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"GitHub"})]}),n.jsxs("div",{className:"flex justify-between text-sm",children:[n.jsx("span",{className:"text-muted-foreground",children:"What's New"}),n.jsxs("button",{onClick:R,className:"text-primary hover:underline flex items-center gap-1",children:[n.jsx(Am,{className:"w-3 h-3"}),"Changelog"]})]}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["After updating, restart the server with ",n.jsx("code",{className:"bg-muted-foreground/10 px-1 rounded",children:"coder-config ui"})]})]})]})]})]})]}),n.jsx(_g,{open:o.open,onOpenChange:G=>u(U=>({...U,open:G})),onSelect:G=>{if(o.field==="toolsDirs"){const U=(e==null?void 0:e.toolsDirs)||(e!=null&&e.toolsDir?[e.toolsDir]:[]);if(o.index===-1)t(L=>{const{toolsDir:M,...B}=L;return{...B,toolsDirs:[...U,G]}});else{const L=[...U];L[o.index]=G,t(M=>{const{toolsDir:B,...q}=M;return{...q,toolsDirs:L}})}}else o.field&&$(o.field,G)},type:o.type,initialPath:o.field==="toolsDirs"&&o.index>=0?((e==null?void 0:e.toolsDirs)||(e!=null&&e.toolsDir?[e.toolsDir]:[]))[o.index]||"~":(e==null?void 0:e[o.field])||"~",title:o.type==="directory"?"Select Directory":"Select File"}),n.jsx(Tt,{open:g.open,onOpenChange:G=>y(U=>({...U,open:G})),children:n.jsxs(St,{className:"max-w-2xl max-h-[80vh] flex flex-col overflow-hidden",children:[n.jsx(Ct,{className:"flex-shrink-0",children:n.jsxs(kt,{className:"flex items-center gap-2",children:[n.jsx(Am,{className:"w-5 h-5"}),"Changelog"]})}),g.loading?n.jsx("div",{className:"flex items-center justify-center py-12",children:n.jsx(ut,{className:"w-6 h-6 animate-spin text-primary"})}):n.jsx(Nn,{className:"h-[60vh]",children:n.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none pr-4",children:n.jsx(vz,{components:{h1:({children:G})=>n.jsx("h1",{className:"text-xl font-bold text-foreground mb-4",children:G}),h2:({children:G})=>n.jsx("h2",{className:"text-lg font-semibold text-foreground mt-6 mb-3 pb-2 border-b border-border",children:G}),h3:({children:G})=>n.jsx("h3",{className:"text-base font-medium text-foreground mt-4 mb-2",children:G}),p:({children:G})=>n.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:G}),ul:({children:G})=>n.jsx("ul",{className:"text-sm text-muted-foreground list-disc pl-5 mb-3 space-y-1",children:G}),li:({children:G})=>n.jsx("li",{className:"text-sm",children:G}),code:({children:G})=>n.jsx("code",{className:"bg-muted px-1 py-0.5 rounded text-xs font-mono",children:G}),hr:()=>n.jsx("hr",{className:"my-4 border-border"}),strong:({children:G})=>n.jsx("strong",{className:"font-semibold text-foreground",children:G})},children:g.content})})})]})})]})}function Cz(){const[e,t]=C.useState(null),[r,s]=C.useState({}),[o,u]=C.useState(!0);C.useEffect(()=>{d()},[]);const d=async()=>{try{u(!0);const[c,f]=await Promise.all([ke.getClaudeSettings(),ke.getRegistry()]);t(c.settings),s(f.mcpServers||{})}catch(c){console.error("Failed to load Claude settings:",c)}finally{u(!1)}},l=async c=>{try{await ke.saveClaudeSettings(c),t(c),ee.success("Claude Code settings saved!")}catch(f){ee.error("Failed to save settings: "+f.message)}};return o?n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx(ut,{className:"w-8 h-8 animate-spin text-indigo-600"})}):n.jsxs("div",{className:"space-y-6",children:[n.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-6 shadow-sm",children:n.jsx(Tj,{settings:e,onSave:l,loading:o,settingsPath:"~/.claude/settings.json",mcpServers:r})}),n.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[n.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),n.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[n.jsx("p",{children:"coder-config init # Initialize project"}),n.jsx("p",{children:"coder-config apply # Generate .mcp.json from config"}),n.jsx("p",{children:"coder-config show # Show current project config"})]})]})]})}function kz(){const[e,t]=C.useState(null),[r,s]=C.useState(!0);C.useEffect(()=>{o()},[]);const o=async()=>{try{s(!0);const d=await ke.getGeminiSettings();t(d.settings)}catch(d){console.error("Failed to load Gemini settings:",d)}finally{s(!1)}},u=async d=>{try{await ke.saveGeminiSettings(d),t(d),ee.success("Gemini CLI settings saved!")}catch(l){ee.error("Failed to save settings: "+l.message)}};return r?n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx(ut,{className:"w-8 h-8 animate-spin text-blue-600"})}):n.jsxs("div",{className:"space-y-6",children:[n.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-6 shadow-sm",children:n.jsx(Rj,{settings:e,onSave:u,loading:r,settingsPath:"~/.gemini/settings.json"})}),n.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[n.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),n.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[n.jsx("p",{children:"coder-config apply # Generate settings for all tools"}),n.jsx("p",{children:"coder-config apply --gemini # Generate Gemini settings only"})]})]})]})}const jz=[{id:"off",name:"Off",description:"Never auto-execute; requires allow list"},{id:"auto",name:"Auto",description:"Safety model determines execution"},{id:"turbo",name:"Turbo",description:"Auto-execute unless in deny list",dangerous:!0}],Nz=[{id:"always-proceed",name:"Always Proceed",description:"Agent never requests review"},{id:"agent-decides",name:"Agent Decides",description:"Agent determines when review is needed"},{id:"request-review",name:"Request Review",description:"Agent always requests review"}],Ez=[{id:"always-proceed",name:"Always Proceed",description:"Maximum autonomy",dangerous:!0},{id:"request-review",name:"Request Review",description:"Ask before browser JavaScript"},{id:"disabled",name:"Disabled",description:"Never run browser JavaScript"}];function Pz({settings:e,onSave:t,loading:r,settingsPath:s}){const[o,u]=C.useState(e||{}),[d,l]=C.useState(!1),[c,f]=C.useState("rich"),[m,h]=C.useState(JSON.stringify(e||{},null,2)),[x,w]=C.useState({open:!1,name:"",json:""}),[k,_]=C.useState({}),v=async()=>{l(!0);try{if(c==="json")try{const T=JSON.parse(m);await t(T),u(T)}catch{ee.error("Invalid JSON"),l(!1);return}else await t(o),h(JSON.stringify(o,null,2));ee.success("Settings saved")}finally{l(!1)}},b=(T,N)=>{u(R=>({...R,[T]:N}))},g=(T,N)=>(o==null?void 0:o[T])??N,y=o.mcpServers||{},j=()=>{const{name:T,json:N}=x;if(!T.trim()){ee.error("Please enter a name for the MCP");return}let R;try{R=JSON.parse(N)}catch{ee.error("Invalid JSON configuration");return}if(!R.command){ee.error('MCP config must have a "command" field');return}u(I=>({...I,mcpServers:{...I.mcpServers,[T.trim()]:R}})),w({open:!1,name:"",json:""}),ee.success(`Added MCP: ${T}`)},E=T=>{u(N=>{const{[T]:R,...I}=N.mcpServers||{};return{...N,mcpServers:I}}),ee.success(`Removed MCP: ${T}`)},P=T=>{_(N=>({...N,[T]:!N[T]}))};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-500/10 flex items-center justify-center",children:n.jsx(wl,{className:"w-5 h-5 text-purple-500"})}),n.jsxs("div",{children:[n.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:["Antigravity Settings",n.jsx(Qe,{variant:"outline",className:"text-xs font-normal text-purple-600 border-purple-300 dark:border-purple-700",children:"Google"})]}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Stored in: ",n.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs",children:s})]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("div",{className:"flex bg-muted rounded-lg p-1",children:[n.jsx("button",{className:`px-3 py-1 text-sm rounded-md transition-colors ${c==="rich"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>f("rich"),children:"Settings"}),n.jsx("button",{className:`px-3 py-1 text-sm rounded-md transition-colors ${c==="json"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>{h(JSON.stringify(o,null,2)),f("json")},children:"JSON"})]}),n.jsxs(le,{onClick:v,disabled:d||r,children:[d?n.jsx(ut,{className:"w-4 h-4 mr-2 animate-spin"}):n.jsx(ui,{className:"w-4 h-4 mr-2"}),"Save"]})]})]}),c==="json"?n.jsx("div",{className:"border border-border rounded-lg bg-card overflow-hidden",children:n.jsx(pt,{value:m,onChange:T=>h(T.target.value),className:"font-mono text-sm min-h-[500px] border-0 rounded-none resize-none",placeholder:"{ }"})}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(as,{className:"w-4 h-4 text-purple-500"}),"Security Policies"]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Terminal Command Execution"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Control how the agent executes shell commands"})]}),n.jsxs(fr,{value:g("terminalPolicy","auto"),onValueChange:T=>b("terminalPolicy",T),children:[n.jsx(ar,{className:"w-44",children:n.jsx(mr,{})}),n.jsx(lr,{children:jz.map(T=>n.jsx(xt,{value:T.id,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{children:T.name}),T.dangerous&&n.jsx(Qe,{variant:"destructive",className:"text-xs",children:"Risk"})]})},T.id))})]})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Review Policy"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"When the agent should request human review"})]}),n.jsxs(fr,{value:g("reviewPolicy","agent-decides"),onValueChange:T=>b("reviewPolicy",T),children:[n.jsx(ar,{className:"w-44",children:n.jsx(mr,{})}),n.jsx(lr,{children:Nz.map(T=>n.jsx(xt,{value:T.id,children:T.name},T.id))})]})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"JavaScript Execution"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Control browser JavaScript execution"})]}),n.jsxs(fr,{value:g("jsPolicy","request-review"),onValueChange:T=>b("jsPolicy",T),children:[n.jsx(ar,{className:"w-44",children:n.jsx(mr,{})}),n.jsx(lr,{children:Ez.map(T=>n.jsx(xt,{value:T.id,children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{children:T.name}),T.dangerous&&n.jsx(Qe,{variant:"destructive",className:"text-xs",children:"Risk"})]})},T.id))})]})]})]})]}),n.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[n.jsx(Fn,{className:"w-4 h-4 text-purple-500"}),"MCP Servers",n.jsx(Qe,{variant:"secondary",className:"text-xs",children:Object.keys(y).length})]}),n.jsxs(le,{size:"sm",variant:"outline",onClick:()=>w({open:!0,name:"",json:`{
|
|
583
583
|
"command": "npx",
|
|
584
584
|
"args": ["-y", "@example/mcp-server"]
|
|
585
585
|
}`}),children:[n.jsx(yt,{className:"w-4 h-4 mr-1"}),"Add MCP"]})]}),n.jsx("div",{className:"space-y-2",children:Object.keys(y).length===0?n.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No MCP servers configured"}):Object.entries(y).map(([T,N])=>n.jsxs(Ml,{open:k[T],onOpenChange:()=>P(T),children:[n.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-background group",children:[n.jsxs(Dl,{className:"flex items-center gap-2 flex-1 text-left",children:[k[T]?n.jsx(Sr,{className:"w-4 h-4 text-muted-foreground"}):n.jsx(Kr,{className:"w-4 h-4 text-muted-foreground"}),n.jsx(Fn,{className:"w-4 h-4 text-purple-500"}),n.jsx("span",{className:"font-medium text-sm",children:T}),n.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:N.command})]}),n.jsx(le,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 text-destructive hover:text-destructive",onClick:()=>E(T),children:n.jsx(jn,{className:"w-4 h-4"})})]}),n.jsx(Ll,{children:n.jsx("div",{className:"mt-2 ml-6 p-3 rounded-lg bg-muted/50 border",children:n.jsx("pre",{className:"text-xs font-mono text-muted-foreground overflow-x-auto",children:JSON.stringify(N,null,2)})})})]},T))})]}),n.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(Bi,{className:"w-4 h-4 text-purple-500"}),"Browser Settings"]}),n.jsx("div",{className:"space-y-4",children:n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"URL Allowlist"}),n.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Domains the agent can visit (one per line)"}),n.jsx(pt,{value:g("browserAllowlist",""),onChange:T=>b("browserAllowlist",T.target.value),placeholder:`github.com
|
|
586
586
|
stackoverflow.com
|
|
587
|
-
docs.python.org`,className:"font-mono text-sm",rows:4})]})})]}),n.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(kn,{className:"w-4 h-4 text-purple-500"}),"Agent Behavior"]}),n.jsx("div",{className:"space-y-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Default Mode"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Planning mode uses structured plans; Fast mode executes directly"})]}),n.jsxs(fr,{value:g("agentMode","planning"),onValueChange:T=>b("agentMode",T),children:[n.jsx(ar,{className:"w-36",children:n.jsx(mr,{})}),n.jsxs(lr,{children:[n.jsx(xt,{value:"planning",children:"Planning"}),n.jsx(xt,{value:"fast",children:"Fast"})]})]})]})})]})]}),n.jsx(Tt,{open:x.open,onOpenChange:T=>w({...x,open:T}),children:n.jsxs(St,{className:"bg-card",children:[n.jsxs(Ct,{children:[n.jsx(kt,{children:"Add MCP Server"}),n.jsx(tr,{children:"Add a new MCP server to Antigravity"})]}),n.jsxs("div",{className:"space-y-4 py-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium",children:"Name"}),n.jsx(ct,{value:x.name,onChange:T=>w({...x,name:T.target.value}),placeholder:"my-mcp-server",className:"mt-1"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium",children:"Configuration (JSON)"}),n.jsx(pt,{value:x.json,onChange:T=>w({...x,json:T.target.value}),className:"mt-1 font-mono text-sm",rows:6})]})]}),n.jsxs(It,{children:[n.jsx(le,{variant:"ghost",onClick:()=>w({open:!1,name:"",json:""}),children:"Cancel"}),n.jsxs(le,{onClick:j,children:[n.jsx(yt,{className:"w-4 h-4 mr-2"}),"Add MCP"]})]})]})})]})}function Az(){const[e,t]=C.useState(null),[r,s]=C.useState(!0);C.useEffect(()=>{o()},[]);const o=async()=>{try{s(!0);const d=await ke.getAntigravitySettings();t(d.settings)}catch(d){console.error("Failed to load Antigravity settings:",d)}finally{s(!1)}},u=async d=>{try{await ke.saveAntigravitySettings(d),t(d),ee.success("Antigravity settings saved!")}catch(l){ee.error("Failed to save settings: "+l.message)}};return r?n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx(ut,{className:"w-8 h-8 animate-spin text-purple-600"})}):n.jsxs("div",{className:"space-y-6",children:[n.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-6 shadow-sm",children:n.jsx(Pz,{settings:e,onSave:u,loading:r,settingsPath:"~/.gemini/antigravity/settings.json"})}),n.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[n.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),n.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[n.jsx("p",{children:"claude-config apply # Generate settings for all tools"}),n.jsx("p",{children:"claude-config apply --antigravity # Generate Antigravity settings only"})]})]})]})}const Tz=[{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",description:"Latest and most capable"},{id:"gpt-5-codex",name:"GPT-5 Codex",description:"Previous generation"},{id:"gpt-5",name:"GPT-5",description:"General purpose"},{id:"o3-mini",name:"o3-mini",description:"Fast reasoning model"}],Rz=[{id:"on-request",name:"On Request",description:"Ask before running commands (default)"},{id:"untrusted",name:"Untrusted",description:"Ask for everything"},{id:"on-failure",name:"On Failure",description:"Ask only when commands fail"},{id:"never",name:"Never",description:"Never ask (use with caution)"}],Mz=[{id:"read-only",name:"Read Only",description:"Can only read files (default)"},{id:"workspace-write",name:"Workspace Write",description:"Can write within workspace"},{id:"danger-full-access",name:"Full Access",description:"Full filesystem access (dangerous)"}],Dz=[{id:"minimal",name:"Minimal",description:"Fastest, least thorough"},{id:"low",name:"Low",description:"Quick responses"},{id:"medium",name:"Medium",description:"Balanced (default)"},{id:"high",name:"High",description:"More thorough"},{id:"xhigh",name:"Extra High",description:"Most thorough"}],Lz=[{id:"save-all",name:"Save All",description:"Keep all session history"},{id:"none",name:"None",description:"Do not persist history"}];function Iz({settings:e,rawToml:t,onSave:r,loading:s,settingsPath:o}){const[u,d]=C.useState(e||{}),[l,c]=C.useState(!1),[f,m]=C.useState("rich"),[h,x]=C.useState(t||""),[w,k]=C.useState({open:!1,name:"",json:""}),[_,v]=C.useState({}),b=async()=>{c(!0);try{f==="toml"?await r(null,h):await r(u),ee.success("Settings saved")}catch(I){ee.error("Failed to save: "+I.message)}finally{c(!1)}},g=(I,O)=>{d($=>({...$,[I]:O}))},y=(I,O,$)=>{d(W=>({...W,[I]:{...W[I],[O]:$}}))},j=(I,O="")=>(u==null?void 0:u[I])??O,E=(I,O,$=!1)=>{var W;return((W=u==null?void 0:u[I])==null?void 0:W[O])??$},P=u.mcp_servers||{},T=()=>{const{name:I,json:O}=w;if(!I.trim()){ee.error("Please enter a name for the MCP server");return}let $;try{$=JSON.parse(O)}catch{ee.error("Invalid JSON configuration");return}if(!$.command){ee.error('MCP config must have a "command" field');return}d(W=>({...W,mcp_servers:{...W.mcp_servers,[I.trim()]:$}})),k({open:!1,name:"",json:""}),ee.success(`Added MCP: ${I}`)},N=I=>{d(O=>{const{[I]:$,...W}=O.mcp_servers||{};return{...O,mcp_servers:W}}),ee.success(`Removed MCP: ${I}`)},R=I=>{v(O=>({...O,[I]:!O[I]}))};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-lg bg-green-500/10 flex items-center justify-center",children:n.jsx(Ft,{className:"w-5 h-5 text-green-500"})}),n.jsxs("div",{children:[n.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:["Codex CLI Settings",n.jsxs(Qe,{variant:"outline",className:"text-xs font-normal text-green-600 border-green-300 dark:border-green-700",children:[n.jsx(Ht,{className:"w-3 h-3 mr-1"}),"OpenAI"]})]}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Stored in: ",n.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs",children:o})]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("div",{className:"flex bg-muted rounded-lg p-1",children:[n.jsx("button",{className:`px-3 py-1 text-sm rounded-md transition-colors ${f==="rich"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>m("rich"),children:"Settings"}),n.jsx("button",{className:`px-3 py-1 text-sm rounded-md transition-colors ${f==="toml"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>m("toml"),children:"TOML"})]}),n.jsxs(le,{onClick:b,disabled:l||s,children:[l?n.jsx(ut,{className:"w-4 h-4 mr-2 animate-spin"}):n.jsx(ui,{className:"w-4 h-4 mr-2"}),"Save"]})]})]}),f==="toml"?n.jsx("div",{className:"border border-border rounded-lg bg-card overflow-hidden",children:n.jsx(pt,{value:h,onChange:I=>x(I.target.value),className:"font-mono text-sm min-h-[500px] border-0 rounded-none resize-none",placeholder:"# Codex CLI config.toml"})}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(Ht,{className:"w-4 h-4 text-green-500"}),"Model"]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Default Model"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Model used for Codex CLI sessions"})]}),n.jsxs(fr,{value:j("model",""),onValueChange:I=>g("model",I),children:[n.jsx(ar,{className:"w-48",children:n.jsx(mr,{placeholder:"Select model"})}),n.jsx(lr,{children:Tz.map(I=>n.jsx(xt,{value:I.id,children:n.jsx("div",{className:"flex flex-col",children:n.jsx("span",{children:I.name})})},I.id))})]})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Reasoning Effort"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"How thoroughly the model should reason"})]}),n.jsxs(fr,{value:j("model_reasoning_effort","medium"),onValueChange:I=>g("model_reasoning_effort",I),children:[n.jsx(ar,{className:"w-48",children:n.jsx(mr,{})}),n.jsx(lr,{children:Dz.map(I=>n.jsx(xt,{value:I.id,children:I.name},I.id))})]})]})]})]}),n.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(as,{className:"w-4 h-4 text-green-500"}),"Security"]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Approval Policy"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"When to ask for command approval"})]}),n.jsxs(fr,{value:j("approval_policy","on-request"),onValueChange:I=>g("approval_policy",I),children:[n.jsx(ar,{className:"w-48",children:n.jsx(mr,{})}),n.jsx(lr,{children:Rz.map(I=>n.jsx(xt,{value:I.id,children:I.name},I.id))})]})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Sandbox Mode"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Filesystem and network access level"})]}),n.jsxs(fr,{value:j("sandbox_mode","read-only"),onValueChange:I=>g("sandbox_mode",I),children:[n.jsx(ar,{className:"w-48",children:n.jsx(mr,{})}),n.jsx(lr,{children:Mz.map(I=>n.jsx(xt,{value:I.id,children:I.name},I.id))})]})]})]})]}),n.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[n.jsx(Fn,{className:"w-4 h-4 text-green-500"}),"MCP Servers",n.jsx(Qe,{variant:"secondary",className:"text-xs",children:Object.keys(P).length})]}),n.jsxs(le,{size:"sm",variant:"outline",onClick:()=>k({open:!0,name:"",json:`{
|
|
587
|
+
docs.python.org`,className:"font-mono text-sm",rows:4})]})})]}),n.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(kn,{className:"w-4 h-4 text-purple-500"}),"Agent Behavior"]}),n.jsx("div",{className:"space-y-4",children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Default Mode"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Planning mode uses structured plans; Fast mode executes directly"})]}),n.jsxs(fr,{value:g("agentMode","planning"),onValueChange:T=>b("agentMode",T),children:[n.jsx(ar,{className:"w-36",children:n.jsx(mr,{})}),n.jsxs(lr,{children:[n.jsx(xt,{value:"planning",children:"Planning"}),n.jsx(xt,{value:"fast",children:"Fast"})]})]})]})})]})]}),n.jsx(Tt,{open:x.open,onOpenChange:T=>w({...x,open:T}),children:n.jsxs(St,{className:"bg-card",children:[n.jsxs(Ct,{children:[n.jsx(kt,{children:"Add MCP Server"}),n.jsx(tr,{children:"Add a new MCP server to Antigravity"})]}),n.jsxs("div",{className:"space-y-4 py-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium",children:"Name"}),n.jsx(ct,{value:x.name,onChange:T=>w({...x,name:T.target.value}),placeholder:"my-mcp-server",className:"mt-1"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium",children:"Configuration (JSON)"}),n.jsx(pt,{value:x.json,onChange:T=>w({...x,json:T.target.value}),className:"mt-1 font-mono text-sm",rows:6})]})]}),n.jsxs(It,{children:[n.jsx(le,{variant:"ghost",onClick:()=>w({open:!1,name:"",json:""}),children:"Cancel"}),n.jsxs(le,{onClick:j,children:[n.jsx(yt,{className:"w-4 h-4 mr-2"}),"Add MCP"]})]})]})})]})}function Az(){const[e,t]=C.useState(null),[r,s]=C.useState(!0);C.useEffect(()=>{o()},[]);const o=async()=>{try{s(!0);const d=await ke.getAntigravitySettings();t(d.settings)}catch(d){console.error("Failed to load Antigravity settings:",d)}finally{s(!1)}},u=async d=>{try{await ke.saveAntigravitySettings(d),t(d),ee.success("Antigravity settings saved!")}catch(l){ee.error("Failed to save settings: "+l.message)}};return r?n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx(ut,{className:"w-8 h-8 animate-spin text-purple-600"})}):n.jsxs("div",{className:"space-y-6",children:[n.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-6 shadow-sm",children:n.jsx(Pz,{settings:e,onSave:u,loading:r,settingsPath:"~/.gemini/antigravity/settings.json"})}),n.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[n.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),n.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[n.jsx("p",{children:"coder-config apply # Generate settings for all tools"}),n.jsx("p",{children:"coder-config apply --antigravity # Generate Antigravity settings only"})]})]})]})}const Tz=[{id:"gpt-5.2-codex",name:"GPT-5.2 Codex",description:"Latest and most capable"},{id:"gpt-5-codex",name:"GPT-5 Codex",description:"Previous generation"},{id:"gpt-5",name:"GPT-5",description:"General purpose"},{id:"o3-mini",name:"o3-mini",description:"Fast reasoning model"}],Rz=[{id:"on-request",name:"On Request",description:"Ask before running commands (default)"},{id:"untrusted",name:"Untrusted",description:"Ask for everything"},{id:"on-failure",name:"On Failure",description:"Ask only when commands fail"},{id:"never",name:"Never",description:"Never ask (use with caution)"}],Mz=[{id:"read-only",name:"Read Only",description:"Can only read files (default)"},{id:"workspace-write",name:"Workspace Write",description:"Can write within workspace"},{id:"danger-full-access",name:"Full Access",description:"Full filesystem access (dangerous)"}],Dz=[{id:"minimal",name:"Minimal",description:"Fastest, least thorough"},{id:"low",name:"Low",description:"Quick responses"},{id:"medium",name:"Medium",description:"Balanced (default)"},{id:"high",name:"High",description:"More thorough"},{id:"xhigh",name:"Extra High",description:"Most thorough"}],Lz=[{id:"save-all",name:"Save All",description:"Keep all session history"},{id:"none",name:"None",description:"Do not persist history"}];function Iz({settings:e,rawToml:t,onSave:r,loading:s,settingsPath:o}){const[u,d]=C.useState(e||{}),[l,c]=C.useState(!1),[f,m]=C.useState("rich"),[h,x]=C.useState(t||""),[w,k]=C.useState({open:!1,name:"",json:""}),[_,v]=C.useState({}),b=async()=>{c(!0);try{f==="toml"?await r(null,h):await r(u),ee.success("Settings saved")}catch(I){ee.error("Failed to save: "+I.message)}finally{c(!1)}},g=(I,O)=>{d($=>({...$,[I]:O}))},y=(I,O,$)=>{d(W=>({...W,[I]:{...W[I],[O]:$}}))},j=(I,O="")=>(u==null?void 0:u[I])??O,E=(I,O,$=!1)=>{var W;return((W=u==null?void 0:u[I])==null?void 0:W[O])??$},P=u.mcp_servers||{},T=()=>{const{name:I,json:O}=w;if(!I.trim()){ee.error("Please enter a name for the MCP server");return}let $;try{$=JSON.parse(O)}catch{ee.error("Invalid JSON configuration");return}if(!$.command){ee.error('MCP config must have a "command" field');return}d(W=>({...W,mcp_servers:{...W.mcp_servers,[I.trim()]:$}})),k({open:!1,name:"",json:""}),ee.success(`Added MCP: ${I}`)},N=I=>{d(O=>{const{[I]:$,...W}=O.mcp_servers||{};return{...O,mcp_servers:W}}),ee.success(`Removed MCP: ${I}`)},R=I=>{v(O=>({...O,[I]:!O[I]}))};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-lg bg-green-500/10 flex items-center justify-center",children:n.jsx(Ft,{className:"w-5 h-5 text-green-500"})}),n.jsxs("div",{children:[n.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:["Codex CLI Settings",n.jsxs(Qe,{variant:"outline",className:"text-xs font-normal text-green-600 border-green-300 dark:border-green-700",children:[n.jsx(Ht,{className:"w-3 h-3 mr-1"}),"OpenAI"]})]}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Stored in: ",n.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs",children:o})]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("div",{className:"flex bg-muted rounded-lg p-1",children:[n.jsx("button",{className:`px-3 py-1 text-sm rounded-md transition-colors ${f==="rich"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>m("rich"),children:"Settings"}),n.jsx("button",{className:`px-3 py-1 text-sm rounded-md transition-colors ${f==="toml"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>m("toml"),children:"TOML"})]}),n.jsxs(le,{onClick:b,disabled:l||s,children:[l?n.jsx(ut,{className:"w-4 h-4 mr-2 animate-spin"}):n.jsx(ui,{className:"w-4 h-4 mr-2"}),"Save"]})]})]}),f==="toml"?n.jsx("div",{className:"border border-border rounded-lg bg-card overflow-hidden",children:n.jsx(pt,{value:h,onChange:I=>x(I.target.value),className:"font-mono text-sm min-h-[500px] border-0 rounded-none resize-none",placeholder:"# Codex CLI config.toml"})}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(Ht,{className:"w-4 h-4 text-green-500"}),"Model"]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Default Model"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Model used for Codex CLI sessions"})]}),n.jsxs(fr,{value:j("model",""),onValueChange:I=>g("model",I),children:[n.jsx(ar,{className:"w-48",children:n.jsx(mr,{placeholder:"Select model"})}),n.jsx(lr,{children:Tz.map(I=>n.jsx(xt,{value:I.id,children:n.jsx("div",{className:"flex flex-col",children:n.jsx("span",{children:I.name})})},I.id))})]})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Reasoning Effort"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"How thoroughly the model should reason"})]}),n.jsxs(fr,{value:j("model_reasoning_effort","medium"),onValueChange:I=>g("model_reasoning_effort",I),children:[n.jsx(ar,{className:"w-48",children:n.jsx(mr,{})}),n.jsx(lr,{children:Dz.map(I=>n.jsx(xt,{value:I.id,children:I.name},I.id))})]})]})]})]}),n.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[n.jsx(as,{className:"w-4 h-4 text-green-500"}),"Security"]}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Approval Policy"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"When to ask for command approval"})]}),n.jsxs(fr,{value:j("approval_policy","on-request"),onValueChange:I=>g("approval_policy",I),children:[n.jsx(ar,{className:"w-48",children:n.jsx(mr,{})}),n.jsx(lr,{children:Rz.map(I=>n.jsx(xt,{value:I.id,children:I.name},I.id))})]})]}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-foreground",children:"Sandbox Mode"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Filesystem and network access level"})]}),n.jsxs(fr,{value:j("sandbox_mode","read-only"),onValueChange:I=>g("sandbox_mode",I),children:[n.jsx(ar,{className:"w-48",children:n.jsx(mr,{})}),n.jsx(lr,{children:Mz.map(I=>n.jsx(xt,{value:I.id,children:I.name},I.id))})]})]})]})]}),n.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h3",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[n.jsx(Fn,{className:"w-4 h-4 text-green-500"}),"MCP Servers",n.jsx(Qe,{variant:"secondary",className:"text-xs",children:Object.keys(P).length})]}),n.jsxs(le,{size:"sm",variant:"outline",onClick:()=>k({open:!0,name:"",json:`{
|
|
588
588
|
"command": "npx",
|
|
589
589
|
"args": ["-y", "@example/mcp-server"],
|
|
590
590
|
"enabled": true
|
|
@@ -615,7 +615,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
|
|
|
615
615
|
"args": ["-y", "@example/mcp-server"]
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
|
-
}`,className:"font-mono text-sm bg-white",rows:6})]}),n.jsxs("div",{className:"mt-4 flex justify-between",children:[n.jsx(le,{variant:"outline",onClick:()=>P({open:!1,url:"",showTerminal:!1,localTool:null,pastedConfig:"",mode:"url"}),children:"Close"}),n.jsxs(le,{onClick:me,disabled:!E.pastedConfig.trim(),className:"bg-green-600 hover:bg-green-700 text-white",children:[n.jsx(yt,{className:"w-4 h-4 mr-2"}),"Add to Registry"]})]})]})]})}),n.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[n.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),n.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[n.jsx("p",{children:"
|
|
618
|
+
}`,className:"font-mono text-sm bg-white",rows:6})]}),n.jsxs("div",{className:"mt-4 flex justify-between",children:[n.jsx(le,{variant:"outline",onClick:()=>P({open:!1,url:"",showTerminal:!1,localTool:null,pastedConfig:"",mode:"url"}),children:"Close"}),n.jsxs(le,{onClick:me,disabled:!E.pastedConfig.trim(),className:"bg-green-600 hover:bg-green-700 text-white",children:[n.jsx(yt,{className:"w-4 h-4 mr-2"}),"Add to Registry"]})]})]})]})}),n.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[n.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),n.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[n.jsx("p",{children:"coder-config list # List available MCPs (✓ = active)"}),n.jsx("p",{children:"coder-config add <mcp> [mcp...] # Add MCP(s) to project"}),n.jsx("p",{children:"coder-config remove <mcp> [mcp...] # Remove MCP(s) from project"}),n.jsx("p",{children:"coder-config registry # List MCPs in registry"}),n.jsx("p",{children:"coder-config registry add <name> '...' # Add MCP to registry"}),n.jsx("p",{children:"coder-config registry remove <name> # Remove from registry"})]})]})]})}function cH({project:e,onUpdate:t}){var O,$,W,Y;const[r,s]=C.useState(null),[o,u]=C.useState(!0),[d,l]=C.useState(null),[c,f]=C.useState(""),[m,h]=C.useState(!1),[x,w]=C.useState("global"),[k,_]=C.useState(""),[v,b]=C.useState([]),[g,y]=C.useState({open:!1,type:"preference",name:"",description:"",wrong:"",right:"",category:"",details:"",title:"",context:"",decision:"",rationale:"",content:""});C.useEffect(()=>{j()},[]);const j=async()=>{try{u(!0);const z=await ke.getMemory();s(z)}catch{ee.error("Failed to load memory")}finally{u(!1)}};C.useEffect(()=>{d&&E(d.path)},[d]);const E=async z=>{try{const K=await ke.getMemoryFile(z);f(K.content||"")}catch{ee.error("Failed to load file")}},P=async()=>{if(d){h(!0);try{await ke.saveMemoryFile(d.path,c),ee.success("Saved!"),j()}catch{ee.error("Failed to save")}finally{h(!1)}}},T=async()=>{if(!k.trim()){b([]);return}try{const z=await ke.searchMemory(k);b(z.results||[])}catch{ee.error("Search failed")}},N=async()=>{let z="";const{type:K}=g;switch(K){case"preference":if(!g.name.trim()){ee.error("Name required");return}z=`**${g.name}**: ${g.description}`;break;case"correction":if(!g.wrong.trim()||!g.right.trim()){ee.error('Both "wrong" and "right" are required');return}z=`**Wrong**: ${g.wrong}
|
|
619
619
|
**Right**: ${g.right}`;break;case"fact":if(!g.category.trim()){ee.error("Category required");return}z=`**${g.category}**: ${g.details}`;break;case"pattern":if(!g.name.trim()){ee.error("Name required");return}z=`**${g.name}**
|
|
620
620
|
${g.description}`;break;case"decision":if(!g.title.trim()){ee.error("Title required");return}z=`**${g.title}**
|
|
621
621
|
|
|
@@ -625,16 +625,16 @@ ${g.description}`;break;case"decision":if(!g.title.trim()){ee.error("Title requi
|
|
|
625
625
|
|
|
626
626
|
**Rationale**: ${g.rationale}`;break;case"issue":if(!g.title.trim()){ee.error("Title required");return}z=`**${g.title}**
|
|
627
627
|
|
|
628
|
-
${g.description}`;break;case"history":case"context":default:if(!g.content.trim()){ee.error("Content required");return}z=g.content;break}try{const G=["pattern","decision","issue","history","context"].includes(K)?"project":"global";await ke.addMemoryEntry(K,z,G),ee.success(`Added ${K} entry`),y({open:!1,type:"preference",name:"",description:"",wrong:"",right:"",category:"",details:"",title:"",context:"",decision:"",rationale:"",content:""}),j()}catch{ee.error("Failed to add entry")}},R=async()=>{try{await ke.initProjectMemory(e.dir),ee.success("Project memory initialized!"),j()}catch(z){ee.error(z.message||"Failed to initialize")}};if(o)return n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx(ut,{className:"w-8 h-8 animate-spin text-indigo-600"})});const I={global:[{id:"preference",label:"Preference",icon:kn,desc:"User preferences (tools, style, etc.)"},{id:"correction",label:"Correction",icon:Oi,desc:"Mistakes to avoid"},{id:"fact",label:"Fact",icon:Li,desc:"Facts about your environment"}],project:[{id:"context",label:"Context",icon:Cr,desc:"Project overview and conventions"},{id:"pattern",label:"Pattern",icon:qu,desc:"Code patterns in this project"},{id:"decision",label:"Decision",icon:Ju,desc:"Architecture decisions"},{id:"issue",label:"Issue",icon:Oi,desc:"Known issues and workarounds"},{id:"history",label:"History",icon:Mf,desc:"Session work log"}]};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-5 shadow-sm",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[n.jsx(Ii,{className:"w-5 h-5 text-purple-600"}),"Memory System"]}),n.jsx("div",{className:"flex gap-2",children:n.jsxs(le,{variant:"outline",size:"sm",onClick:()=>y({open:!0,type:"preference",name:"",description:"",wrong:"",right:"",category:"",details:"",title:"",context:"",decision:"",rationale:"",content:""}),children:[n.jsx(yt,{className:"w-4 h-4 mr-2"}),"Add Entry"]})})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(ct,{placeholder:"Search memory...",value:k,onChange:z=>_(z.target.value),onKeyDown:z=>z.key==="Enter"&&T(),className:"flex-1"}),n.jsx(le,{variant:"outline",onClick:T,children:n.jsx(_l,{className:"w-4 h-4"})})]}),v.length>0&&n.jsxs("div",{className:"mt-4 p-3 bg-gray-50 dark:bg-slate-900 rounded-lg",children:[n.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:"Search Results"}),n.jsx("div",{className:"space-y-2",children:v.map((z,K)=>n.jsxs("div",{className:"text-sm",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Qe,{variant:z.scope==="global"?"default":"secondary",children:z.scope}),n.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:z.file})]}),z.matches.map((G,U)=>n.jsxs("div",{className:"ml-4 text-gray-600 dark:text-slate-400 text-xs mt-1",children:["Line ",G.line,": ",G.text]},U))]},K))})]})]}),n.jsx("div",{className:"flex gap-2 border-b border-gray-200 dark:border-slate-700 pb-2",children:["global","project","sync"].map(z=>n.jsxs("button",{onClick:()=>w(z),className:`px-4 py-2 text-sm font-medium rounded-t-lg transition-colors ${x===z?"bg-white dark:bg-slate-950 border border-b-white dark:border-b-slate-950 border-gray-200 dark:border-slate-700 -mb-[1px] text-indigo-600 dark:text-indigo-400":"text-gray-600 dark:text-slate-400 hover:text-gray-900 dark:hover:text-white"}`,children:[z.charAt(0).toUpperCase()+z.slice(1)," Memory"]},z))}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[n.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 overflow-hidden shadow-sm",children:[n.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700",children:[n.jsxs("h3",{className:"font-medium text-gray-900 dark:text-white",children:[x==="global"&&"Global Memory Files",x==="project"&&"Project Memory Files",x==="sync"&&"Sync State"]}),n.jsxs("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:[x==="global"&&"~/.claude/memory/",x==="project"&&`${e.dir}/.claude/memory/`,x==="sync"&&"~/.claude/sync/"]})]}),n.jsxs("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:[x==="global"&&((O=r==null?void 0:r.global)==null?void 0:O.files.map(z=>n.jsxs("button",{onClick:()=>z.exists&&l(z),className:`w-full px-4 py-3 flex items-center gap-3 text-left hover:bg-gray-50 dark:hover:bg-slate-900 transition-colors ${(d==null?void 0:d.path)===z.path?"bg-indigo-50 dark:bg-indigo-950/30":""} ${z.exists?"":"opacity-50"}`,children:[n.jsx(Cr,{className:"w-4 h-4 text-gray-400 dark:text-slate-500"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:z.name}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:z.type})]}),z.exists?n.jsx(Kt,{className:"w-4 h-4 text-green-500"}):n.jsx("span",{className:"text-xs text-gray-400 dark:text-slate-500",children:"Not created"})]},z.name))),x==="project"&&n.jsx(n.Fragment,{children:($=r==null?void 0:r.project)!=null&&$.initialized?(W=r==null?void 0:r.project)==null?void 0:W.files.map(z=>n.jsxs("button",{onClick:()=>z.exists&&l(z),className:`w-full px-4 py-3 flex items-center gap-3 text-left hover:bg-gray-50 dark:hover:bg-slate-900 transition-colors ${(d==null?void 0:d.path)===z.path?"bg-indigo-50 dark:bg-indigo-950/30":""} ${z.exists?"":"opacity-50"}`,children:[n.jsx(Cr,{className:"w-4 h-4 text-gray-400 dark:text-slate-500"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:z.name}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:z.type})]}),z.exists?n.jsx(Kt,{className:"w-4 h-4 text-green-500"}):n.jsx("span",{className:"text-xs text-gray-400 dark:text-slate-500",children:"Not created"})]},z.name)):n.jsxs("div",{className:"p-6 text-center",children:[n.jsx(Ii,{className:"w-12 h-12 text-gray-300 dark:text-slate-600 mx-auto mb-3"}),n.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400 mb-4",children:"Project memory not initialized"}),n.jsxs(le,{onClick:R,className:"bg-purple-600 hover:bg-purple-700 text-white",children:[n.jsx(yt,{className:"w-4 h-4 mr-2"}),"Initialize Project Memory"]})]})}),x==="sync"&&n.jsx("div",{className:"p-4",children:(Y=r==null?void 0:r.sync)!=null&&Y.state?n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:"Current State"}),n.jsx("pre",{className:"text-xs bg-gray-50 dark:bg-slate-900 p-3 rounded overflow-auto max-h-48 text-gray-800 dark:text-slate-300",children:JSON.stringify(r.sync.state,null,2)})]}),r.sync.history.length>0&&n.jsxs("div",{children:[n.jsxs("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:["History (",r.sync.history.length,")"]}),n.jsx("div",{className:"space-y-1",children:r.sync.history.map((z,K)=>n.jsxs("div",{className:"text-xs text-gray-600 dark:text-slate-400 flex items-center gap-2",children:[n.jsx(Mf,{className:"w-3 h-3"}),z.name]},K))})]})]}):n.jsxs("div",{className:"text-center py-6",children:[n.jsx(Mf,{className:"w-12 h-12 text-gray-300 dark:text-slate-600 mx-auto mb-3"}),n.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400",children:"No sync state"}),n.jsx("p",{className:"text-xs text-gray-400 dark:text-slate-500 mt-1",children:"State is created by session hooks"})]})})]})]}),n.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 overflow-hidden shadow-sm",children:[n.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700 flex items-center justify-between",children:[n.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:d?d.name:"Select a file"}),d&&n.jsxs(le,{size:"sm",onClick:P,disabled:m,className:"bg-indigo-600 hover:bg-indigo-700 text-white",children:[m?n.jsx(ut,{className:"w-4 h-4 mr-2 animate-spin"}):n.jsx(ui,{className:"w-4 h-4 mr-2"}),"Save"]})]}),n.jsx("div",{className:"p-4",children:d?n.jsx(pt,{value:c,onChange:z=>f(z.target.value),className:"font-mono text-sm min-h-[400px]",placeholder:"File content..."}):n.jsx("div",{className:"flex items-center justify-center h-[400px] text-gray-400 dark:text-slate-500",children:n.jsxs("div",{className:"text-center",children:[n.jsx(Cr,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),n.jsx("p",{children:"Select a file to edit"})]})})})]})]}),n.jsx(Tt,{open:g.open,onOpenChange:z=>y({...g,open:z}),children:n.jsxs(St,{className:"max-w-lg",children:[n.jsxs(Ct,{children:[n.jsx(kt,{children:"Add Memory Entry"}),n.jsx(tr,{children:"Add a new entry to the appropriate memory file."})]}),n.jsxs("div",{className:"py-4 space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Entry Type"}),n.jsx("div",{className:"mt-2 grid grid-cols-2 gap-2",children:[...I.global,...I.project].map(z=>{const K=z.icon,G=I.global.some(U=>U.id===z.id);return n.jsxs("button",{onClick:()=>y({...g,type:z.id}),className:`p-2 rounded-lg border text-left transition-colors ${g.type===z.id?"border-indigo-500 bg-indigo-50 dark:bg-indigo-950/30":"border-gray-200 dark:border-slate-700 hover:border-gray-300 dark:hover:border-slate-600"}`,children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(K,{className:"w-4 h-4 text-gray-500 dark:text-slate-400"}),n.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:z.label})]}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:G?"Global":"Project"})]},z.id)})})]}),g.type==="preference"&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Name"}),n.jsx(ct,{value:g.name,onChange:z=>y({...g,name:z.target.value}),placeholder:"e.g., package-manager",className:"mt-1"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Description"}),n.jsx(ct,{value:g.description,onChange:z=>y({...g,description:z.target.value}),placeholder:"e.g., Always use pnpm instead of npm",className:"mt-1"})]})]}),g.type==="correction"&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Wrong (what to avoid)"}),n.jsx(pt,{value:g.wrong,onChange:z=>y({...g,wrong:z.target.value}),placeholder:"e.g., Using npm install",className:"mt-1",rows:2})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Right (what to do instead)"}),n.jsx(pt,{value:g.right,onChange:z=>y({...g,right:z.target.value}),placeholder:"e.g., Use pnpm install",className:"mt-1",rows:2})]})]}),g.type==="fact"&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Category"}),n.jsx(ct,{value:g.category,onChange:z=>y({...g,category:z.target.value}),placeholder:"e.g., shell, editor, system",className:"mt-1"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Details"}),n.jsx(pt,{value:g.details,onChange:z=>y({...g,details:z.target.value}),placeholder:"e.g., Using zsh with oh-my-zsh",className:"mt-1",rows:2})]})]}),g.type==="pattern"&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Pattern Name"}),n.jsx(ct,{value:g.name,onChange:z=>y({...g,name:z.target.value}),placeholder:"e.g., API Response Format",className:"mt-1"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Description"}),n.jsx(pt,{value:g.description,onChange:z=>y({...g,description:z.target.value}),placeholder:"Describe the pattern and when to use it...",className:"mt-1",rows:3})]})]}),g.type==="decision"&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Title"}),n.jsx(ct,{value:g.title,onChange:z=>y({...g,title:z.target.value}),placeholder:"e.g., Use React Query for data fetching",className:"mt-1"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Context"}),n.jsx(pt,{value:g.context,onChange:z=>y({...g,context:z.target.value}),placeholder:"What problem were we solving?",className:"mt-1",rows:2})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Decision"}),n.jsx(pt,{value:g.decision,onChange:z=>y({...g,decision:z.target.value}),placeholder:"What did we decide?",className:"mt-1",rows:2})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Rationale"}),n.jsx(pt,{value:g.rationale,onChange:z=>y({...g,rationale:z.target.value}),placeholder:"Why this choice over alternatives?",className:"mt-1",rows:2})]})]}),g.type==="issue"&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Issue Title"}),n.jsx(ct,{value:g.title,onChange:z=>y({...g,title:z.target.value}),placeholder:"e.g., Memory leak in useEffect",className:"mt-1"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Description / Workaround"}),n.jsx(pt,{value:g.description,onChange:z=>y({...g,description:z.target.value}),placeholder:"Describe the issue and any workarounds...",className:"mt-1",rows:3})]})]}),(g.type==="history"||g.type==="context")&&n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Content"}),n.jsx(pt,{value:g.content,onChange:z=>y({...g,content:z.target.value}),placeholder:g.type==="history"?"What work was done this session?":"Project context and overview...",className:"mt-1",rows:4})]})]}),n.jsxs(It,{children:[n.jsx(le,{variant:"ghost",onClick:()=>y({...g,open:!1}),children:"Cancel"}),n.jsxs(le,{onClick:N,className:"bg-purple-600 hover:bg-purple-700 text-white",children:[n.jsx(yt,{className:"w-4 h-4 mr-2"}),"Add Entry"]})]})]})}),n.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[n.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),n.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[n.jsx("p",{children:"claude-config memory # Show memory status"}),n.jsx("p",{children:"claude-config memory init # Initialize project memory"}),n.jsx("p",{children:'claude-config memory add <type> "<content>" # Add entry'}),n.jsx("p",{children:"claude-config memory search <query> # Search all memory"}),n.jsx("p",{className:"text-gray-400 dark:text-slate-500 text-xs mt-2",children:"# Types: preference, correction, fact (global) | context, pattern, decision, issue, history (project)"})]})]})]})}function uH({onProjectSwitch:e}){const[t,r]=C.useState([]),[s,o]=C.useState(null),[u,d]=C.useState(!0),[l,c]=C.useState(null),[f,m]=C.useState(!1);C.useEffect(()=>{h()},[]);const h=async()=>{try{d(!0);const _=await ke.getProjects();r(_.projects||[]),o(_.activeProjectId)}catch{ee.error("Failed to load projects")}finally{d(!1)}},x=async _=>{c(_);try{const v=await ke.setActiveProject(_);v.success?(o(_),r(b=>b.map(g=>({...g,isActive:g.id===_}))),ee.success(`Switched to ${v.project.name}`),e==null||e(v)):ee.error(v.error||"Failed to switch project")}catch(v){ee.error("Failed to switch project: "+v.message)}finally{c(null)}},w=async _=>{if(confirm(`Remove "${_.name}" from the registry?
|
|
628
|
+
${g.description}`;break;case"history":case"context":default:if(!g.content.trim()){ee.error("Content required");return}z=g.content;break}try{const G=["pattern","decision","issue","history","context"].includes(K)?"project":"global";await ke.addMemoryEntry(K,z,G),ee.success(`Added ${K} entry`),y({open:!1,type:"preference",name:"",description:"",wrong:"",right:"",category:"",details:"",title:"",context:"",decision:"",rationale:"",content:""}),j()}catch{ee.error("Failed to add entry")}},R=async()=>{try{await ke.initProjectMemory(e.dir),ee.success("Project memory initialized!"),j()}catch(z){ee.error(z.message||"Failed to initialize")}};if(o)return n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx(ut,{className:"w-8 h-8 animate-spin text-indigo-600"})});const I={global:[{id:"preference",label:"Preference",icon:kn,desc:"User preferences (tools, style, etc.)"},{id:"correction",label:"Correction",icon:Oi,desc:"Mistakes to avoid"},{id:"fact",label:"Fact",icon:Li,desc:"Facts about your environment"}],project:[{id:"context",label:"Context",icon:Cr,desc:"Project overview and conventions"},{id:"pattern",label:"Pattern",icon:qu,desc:"Code patterns in this project"},{id:"decision",label:"Decision",icon:Ju,desc:"Architecture decisions"},{id:"issue",label:"Issue",icon:Oi,desc:"Known issues and workarounds"},{id:"history",label:"History",icon:Mf,desc:"Session work log"}]};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 p-5 shadow-sm",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[n.jsx(Ii,{className:"w-5 h-5 text-purple-600"}),"Memory System"]}),n.jsx("div",{className:"flex gap-2",children:n.jsxs(le,{variant:"outline",size:"sm",onClick:()=>y({open:!0,type:"preference",name:"",description:"",wrong:"",right:"",category:"",details:"",title:"",context:"",decision:"",rationale:"",content:""}),children:[n.jsx(yt,{className:"w-4 h-4 mr-2"}),"Add Entry"]})})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(ct,{placeholder:"Search memory...",value:k,onChange:z=>_(z.target.value),onKeyDown:z=>z.key==="Enter"&&T(),className:"flex-1"}),n.jsx(le,{variant:"outline",onClick:T,children:n.jsx(_l,{className:"w-4 h-4"})})]}),v.length>0&&n.jsxs("div",{className:"mt-4 p-3 bg-gray-50 dark:bg-slate-900 rounded-lg",children:[n.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:"Search Results"}),n.jsx("div",{className:"space-y-2",children:v.map((z,K)=>n.jsxs("div",{className:"text-sm",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Qe,{variant:z.scope==="global"?"default":"secondary",children:z.scope}),n.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:z.file})]}),z.matches.map((G,U)=>n.jsxs("div",{className:"ml-4 text-gray-600 dark:text-slate-400 text-xs mt-1",children:["Line ",G.line,": ",G.text]},U))]},K))})]})]}),n.jsx("div",{className:"flex gap-2 border-b border-gray-200 dark:border-slate-700 pb-2",children:["global","project","sync"].map(z=>n.jsxs("button",{onClick:()=>w(z),className:`px-4 py-2 text-sm font-medium rounded-t-lg transition-colors ${x===z?"bg-white dark:bg-slate-950 border border-b-white dark:border-b-slate-950 border-gray-200 dark:border-slate-700 -mb-[1px] text-indigo-600 dark:text-indigo-400":"text-gray-600 dark:text-slate-400 hover:text-gray-900 dark:hover:text-white"}`,children:[z.charAt(0).toUpperCase()+z.slice(1)," Memory"]},z))}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[n.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 overflow-hidden shadow-sm",children:[n.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700",children:[n.jsxs("h3",{className:"font-medium text-gray-900 dark:text-white",children:[x==="global"&&"Global Memory Files",x==="project"&&"Project Memory Files",x==="sync"&&"Sync State"]}),n.jsxs("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:[x==="global"&&"~/.claude/memory/",x==="project"&&`${e.dir}/.claude/memory/`,x==="sync"&&"~/.claude/sync/"]})]}),n.jsxs("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:[x==="global"&&((O=r==null?void 0:r.global)==null?void 0:O.files.map(z=>n.jsxs("button",{onClick:()=>z.exists&&l(z),className:`w-full px-4 py-3 flex items-center gap-3 text-left hover:bg-gray-50 dark:hover:bg-slate-900 transition-colors ${(d==null?void 0:d.path)===z.path?"bg-indigo-50 dark:bg-indigo-950/30":""} ${z.exists?"":"opacity-50"}`,children:[n.jsx(Cr,{className:"w-4 h-4 text-gray-400 dark:text-slate-500"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:z.name}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:z.type})]}),z.exists?n.jsx(Kt,{className:"w-4 h-4 text-green-500"}):n.jsx("span",{className:"text-xs text-gray-400 dark:text-slate-500",children:"Not created"})]},z.name))),x==="project"&&n.jsx(n.Fragment,{children:($=r==null?void 0:r.project)!=null&&$.initialized?(W=r==null?void 0:r.project)==null?void 0:W.files.map(z=>n.jsxs("button",{onClick:()=>z.exists&&l(z),className:`w-full px-4 py-3 flex items-center gap-3 text-left hover:bg-gray-50 dark:hover:bg-slate-900 transition-colors ${(d==null?void 0:d.path)===z.path?"bg-indigo-50 dark:bg-indigo-950/30":""} ${z.exists?"":"opacity-50"}`,children:[n.jsx(Cr,{className:"w-4 h-4 text-gray-400 dark:text-slate-500"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:z.name}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400",children:z.type})]}),z.exists?n.jsx(Kt,{className:"w-4 h-4 text-green-500"}):n.jsx("span",{className:"text-xs text-gray-400 dark:text-slate-500",children:"Not created"})]},z.name)):n.jsxs("div",{className:"p-6 text-center",children:[n.jsx(Ii,{className:"w-12 h-12 text-gray-300 dark:text-slate-600 mx-auto mb-3"}),n.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400 mb-4",children:"Project memory not initialized"}),n.jsxs(le,{onClick:R,className:"bg-purple-600 hover:bg-purple-700 text-white",children:[n.jsx(yt,{className:"w-4 h-4 mr-2"}),"Initialize Project Memory"]})]})}),x==="sync"&&n.jsx("div",{className:"p-4",children:(Y=r==null?void 0:r.sync)!=null&&Y.state?n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:"Current State"}),n.jsx("pre",{className:"text-xs bg-gray-50 dark:bg-slate-900 p-3 rounded overflow-auto max-h-48 text-gray-800 dark:text-slate-300",children:JSON.stringify(r.sync.state,null,2)})]}),r.sync.history.length>0&&n.jsxs("div",{children:[n.jsxs("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:["History (",r.sync.history.length,")"]}),n.jsx("div",{className:"space-y-1",children:r.sync.history.map((z,K)=>n.jsxs("div",{className:"text-xs text-gray-600 dark:text-slate-400 flex items-center gap-2",children:[n.jsx(Mf,{className:"w-3 h-3"}),z.name]},K))})]})]}):n.jsxs("div",{className:"text-center py-6",children:[n.jsx(Mf,{className:"w-12 h-12 text-gray-300 dark:text-slate-600 mx-auto mb-3"}),n.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400",children:"No sync state"}),n.jsx("p",{className:"text-xs text-gray-400 dark:text-slate-500 mt-1",children:"State is created by session hooks"})]})})]})]}),n.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 overflow-hidden shadow-sm",children:[n.jsxs("div",{className:"p-4 border-b border-gray-200 dark:border-slate-700 flex items-center justify-between",children:[n.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:d?d.name:"Select a file"}),d&&n.jsxs(le,{size:"sm",onClick:P,disabled:m,className:"bg-indigo-600 hover:bg-indigo-700 text-white",children:[m?n.jsx(ut,{className:"w-4 h-4 mr-2 animate-spin"}):n.jsx(ui,{className:"w-4 h-4 mr-2"}),"Save"]})]}),n.jsx("div",{className:"p-4",children:d?n.jsx(pt,{value:c,onChange:z=>f(z.target.value),className:"font-mono text-sm min-h-[400px]",placeholder:"File content..."}):n.jsx("div",{className:"flex items-center justify-center h-[400px] text-gray-400 dark:text-slate-500",children:n.jsxs("div",{className:"text-center",children:[n.jsx(Cr,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),n.jsx("p",{children:"Select a file to edit"})]})})})]})]}),n.jsx(Tt,{open:g.open,onOpenChange:z=>y({...g,open:z}),children:n.jsxs(St,{className:"max-w-lg",children:[n.jsxs(Ct,{children:[n.jsx(kt,{children:"Add Memory Entry"}),n.jsx(tr,{children:"Add a new entry to the appropriate memory file."})]}),n.jsxs("div",{className:"py-4 space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Entry Type"}),n.jsx("div",{className:"mt-2 grid grid-cols-2 gap-2",children:[...I.global,...I.project].map(z=>{const K=z.icon,G=I.global.some(U=>U.id===z.id);return n.jsxs("button",{onClick:()=>y({...g,type:z.id}),className:`p-2 rounded-lg border text-left transition-colors ${g.type===z.id?"border-indigo-500 bg-indigo-50 dark:bg-indigo-950/30":"border-gray-200 dark:border-slate-700 hover:border-gray-300 dark:hover:border-slate-600"}`,children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(K,{className:"w-4 h-4 text-gray-500 dark:text-slate-400"}),n.jsx("span",{className:"text-sm font-medium text-gray-900 dark:text-white",children:z.label})]}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:G?"Global":"Project"})]},z.id)})})]}),g.type==="preference"&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Name"}),n.jsx(ct,{value:g.name,onChange:z=>y({...g,name:z.target.value}),placeholder:"e.g., package-manager",className:"mt-1"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Description"}),n.jsx(ct,{value:g.description,onChange:z=>y({...g,description:z.target.value}),placeholder:"e.g., Always use pnpm instead of npm",className:"mt-1"})]})]}),g.type==="correction"&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Wrong (what to avoid)"}),n.jsx(pt,{value:g.wrong,onChange:z=>y({...g,wrong:z.target.value}),placeholder:"e.g., Using npm install",className:"mt-1",rows:2})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Right (what to do instead)"}),n.jsx(pt,{value:g.right,onChange:z=>y({...g,right:z.target.value}),placeholder:"e.g., Use pnpm install",className:"mt-1",rows:2})]})]}),g.type==="fact"&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Category"}),n.jsx(ct,{value:g.category,onChange:z=>y({...g,category:z.target.value}),placeholder:"e.g., shell, editor, system",className:"mt-1"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Details"}),n.jsx(pt,{value:g.details,onChange:z=>y({...g,details:z.target.value}),placeholder:"e.g., Using zsh with oh-my-zsh",className:"mt-1",rows:2})]})]}),g.type==="pattern"&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Pattern Name"}),n.jsx(ct,{value:g.name,onChange:z=>y({...g,name:z.target.value}),placeholder:"e.g., API Response Format",className:"mt-1"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Description"}),n.jsx(pt,{value:g.description,onChange:z=>y({...g,description:z.target.value}),placeholder:"Describe the pattern and when to use it...",className:"mt-1",rows:3})]})]}),g.type==="decision"&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Title"}),n.jsx(ct,{value:g.title,onChange:z=>y({...g,title:z.target.value}),placeholder:"e.g., Use React Query for data fetching",className:"mt-1"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Context"}),n.jsx(pt,{value:g.context,onChange:z=>y({...g,context:z.target.value}),placeholder:"What problem were we solving?",className:"mt-1",rows:2})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Decision"}),n.jsx(pt,{value:g.decision,onChange:z=>y({...g,decision:z.target.value}),placeholder:"What did we decide?",className:"mt-1",rows:2})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Rationale"}),n.jsx(pt,{value:g.rationale,onChange:z=>y({...g,rationale:z.target.value}),placeholder:"Why this choice over alternatives?",className:"mt-1",rows:2})]})]}),g.type==="issue"&&n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Issue Title"}),n.jsx(ct,{value:g.title,onChange:z=>y({...g,title:z.target.value}),placeholder:"e.g., Memory leak in useEffect",className:"mt-1"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Description / Workaround"}),n.jsx(pt,{value:g.description,onChange:z=>y({...g,description:z.target.value}),placeholder:"Describe the issue and any workarounds...",className:"mt-1",rows:3})]})]}),(g.type==="history"||g.type==="context")&&n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Content"}),n.jsx(pt,{value:g.content,onChange:z=>y({...g,content:z.target.value}),placeholder:g.type==="history"?"What work was done this session?":"Project context and overview...",className:"mt-1",rows:4})]})]}),n.jsxs(It,{children:[n.jsx(le,{variant:"ghost",onClick:()=>y({...g,open:!1}),children:"Cancel"}),n.jsxs(le,{onClick:N,className:"bg-purple-600 hover:bg-purple-700 text-white",children:[n.jsx(yt,{className:"w-4 h-4 mr-2"}),"Add Entry"]})]})]})}),n.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[n.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),n.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[n.jsx("p",{children:"coder-config memory # Show memory status"}),n.jsx("p",{children:"coder-config memory init # Initialize project memory"}),n.jsx("p",{children:'coder-config memory add <type> "<content>" # Add entry'}),n.jsx("p",{children:"coder-config memory search <query> # Search all memory"}),n.jsx("p",{className:"text-gray-400 dark:text-slate-500 text-xs mt-2",children:"# Types: preference, correction, fact (global) | context, pattern, decision, issue, history (project)"})]})]})]})}function uH({onProjectSwitch:e}){const[t,r]=C.useState([]),[s,o]=C.useState(null),[u,d]=C.useState(!0),[l,c]=C.useState(null),[f,m]=C.useState(!1);C.useEffect(()=>{h()},[]);const h=async()=>{try{d(!0);const _=await ke.getProjects();r(_.projects||[]),o(_.activeProjectId)}catch{ee.error("Failed to load projects")}finally{d(!1)}},x=async _=>{c(_);try{const v=await ke.setActiveProject(_);v.success?(o(_),r(b=>b.map(g=>({...g,isActive:g.id===_}))),ee.success(`Switched to ${v.project.name}`),e==null||e(v)):ee.error(v.error||"Failed to switch project")}catch(v){ee.error("Failed to switch project: "+v.message)}finally{c(null)}},w=async _=>{if(confirm(`Remove "${_.name}" from the registry?
|
|
629
629
|
|
|
630
|
-
This won't delete any files.`))try{const v=await ke.removeProject(_.id);v.success?(r(b=>b.filter(g=>g.id!==_.id)),ee.success(`Removed project: ${_.name}`)):ee.error(v.error||"Failed to remove project")}catch(v){ee.error("Failed to remove project: "+v.message)}},k=_=>{r(v=>[...v,{..._,exists:!0,hasClaudeConfig:!1}])};return u?n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx(ut,{className:"w-8 h-8 animate-spin text-indigo-600"})}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-lg bg-indigo-100 dark:bg-indigo-900/30 flex items-center justify-center",children:n.jsx(si,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Projects"}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:"Registered projects for quick switching"})]})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(le,{variant:"outline",onClick:h,size:"sm",children:[n.jsx(pr,{className:"w-4 h-4 mr-2"}),"Refresh"]}),n.jsxs(le,{onClick:()=>m(!0),className:"bg-indigo-600 hover:bg-indigo-700",children:[n.jsx(yt,{className:"w-4 h-4 mr-2"}),"Add Project"]})]})]}),n.jsx("div",{className:"bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 rounded-lg p-4 text-sm text-blue-700 dark:text-blue-400",children:n.jsx("p",{children:"Projects registered here can be quickly switched in the header dropdown. The UI will update to show the selected project's configuration."})}),n.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm overflow-hidden",children:t.length===0?n.jsxs("div",{className:"p-12 text-center",children:[n.jsx(wr,{className:"w-12 h-12 mx-auto mb-4 text-gray-300 dark:text-slate-600"}),n.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"No Projects Yet"}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 mb-4",children:"Add your first project to get started with quick switching."}),n.jsxs(le,{onClick:()=>m(!0),children:[n.jsx(yt,{className:"w-4 h-4 mr-2"}),"Add Your First Project"]})]}):n.jsx("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:t.map(_=>n.jsxs("div",{className:`p-4 flex items-center gap-4 transition-colors ${_.isActive?"bg-indigo-50 dark:bg-indigo-950/30":"hover:bg-gray-50 dark:hover:bg-slate-900"}`,children:[n.jsx("div",{className:`w-10 h-10 rounded-lg flex items-center justify-center ${_.isActive?"bg-indigo-100 dark:bg-indigo-900/50":_.exists?"bg-gray-100 dark:bg-slate-800":"bg-amber-100 dark:bg-amber-900/30"}`,children:_.isActive?n.jsx(Kt,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"}):_.exists?n.jsx(wr,{className:"w-5 h-5 text-gray-500 dark:text-slate-400"}):n.jsx(Xu,{className:"w-5 h-5 text-amber-600 dark:text-amber-400"})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h3",{className:`font-medium truncate ${_.isActive?"text-indigo-700 dark:text-indigo-400":"text-gray-900 dark:text-white"}`,children:_.name}),_.hasClaudeConfig&&n.jsx("span",{className:"text-xs bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 px-1.5 py-0.5 rounded",children:".claude"}),_.isActive&&n.jsx("span",{className:"text-xs bg-indigo-100 dark:bg-indigo-900/50 text-indigo-700 dark:text-indigo-400 px-1.5 py-0.5 rounded",children:"Active"})]}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 font-mono truncate",children:_.path.replace(/^\/Users\/[^/]+/,"~")}),!_.exists&&n.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400 mt-1",children:"Path not found - the directory may have been moved or deleted"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[!_.isActive&&_.exists&&n.jsx(le,{size:"sm",onClick:()=>x(_.id),disabled:l===_.id,children:l===_.id?n.jsx(ut,{className:"w-4 h-4 animate-spin"}):"Select"}),n.jsx(le,{size:"sm",variant:"ghost",onClick:()=>w(_),className:"text-gray-500 dark:text-slate-400 hover:text-red-600 dark:hover:text-red-400",title:"Remove from registry",children:n.jsx(jn,{className:"w-4 h-4"})})]})]},_.id))})}),n.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[n.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),n.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[n.jsx("p",{children:"
|
|
630
|
+
This won't delete any files.`))try{const v=await ke.removeProject(_.id);v.success?(r(b=>b.filter(g=>g.id!==_.id)),ee.success(`Removed project: ${_.name}`)):ee.error(v.error||"Failed to remove project")}catch(v){ee.error("Failed to remove project: "+v.message)}},k=_=>{r(v=>[...v,{..._,exists:!0,hasClaudeConfig:!1}])};return u?n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx(ut,{className:"w-8 h-8 animate-spin text-indigo-600"})}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-lg bg-indigo-100 dark:bg-indigo-900/30 flex items-center justify-center",children:n.jsx(si,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Projects"}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:"Registered projects for quick switching"})]})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(le,{variant:"outline",onClick:h,size:"sm",children:[n.jsx(pr,{className:"w-4 h-4 mr-2"}),"Refresh"]}),n.jsxs(le,{onClick:()=>m(!0),className:"bg-indigo-600 hover:bg-indigo-700",children:[n.jsx(yt,{className:"w-4 h-4 mr-2"}),"Add Project"]})]})]}),n.jsx("div",{className:"bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 rounded-lg p-4 text-sm text-blue-700 dark:text-blue-400",children:n.jsx("p",{children:"Projects registered here can be quickly switched in the header dropdown. The UI will update to show the selected project's configuration."})}),n.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm overflow-hidden",children:t.length===0?n.jsxs("div",{className:"p-12 text-center",children:[n.jsx(wr,{className:"w-12 h-12 mx-auto mb-4 text-gray-300 dark:text-slate-600"}),n.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"No Projects Yet"}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 mb-4",children:"Add your first project to get started with quick switching."}),n.jsxs(le,{onClick:()=>m(!0),children:[n.jsx(yt,{className:"w-4 h-4 mr-2"}),"Add Your First Project"]})]}):n.jsx("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:t.map(_=>n.jsxs("div",{className:`p-4 flex items-center gap-4 transition-colors ${_.isActive?"bg-indigo-50 dark:bg-indigo-950/30":"hover:bg-gray-50 dark:hover:bg-slate-900"}`,children:[n.jsx("div",{className:`w-10 h-10 rounded-lg flex items-center justify-center ${_.isActive?"bg-indigo-100 dark:bg-indigo-900/50":_.exists?"bg-gray-100 dark:bg-slate-800":"bg-amber-100 dark:bg-amber-900/30"}`,children:_.isActive?n.jsx(Kt,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"}):_.exists?n.jsx(wr,{className:"w-5 h-5 text-gray-500 dark:text-slate-400"}):n.jsx(Xu,{className:"w-5 h-5 text-amber-600 dark:text-amber-400"})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h3",{className:`font-medium truncate ${_.isActive?"text-indigo-700 dark:text-indigo-400":"text-gray-900 dark:text-white"}`,children:_.name}),_.hasClaudeConfig&&n.jsx("span",{className:"text-xs bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 px-1.5 py-0.5 rounded",children:".claude"}),_.isActive&&n.jsx("span",{className:"text-xs bg-indigo-100 dark:bg-indigo-900/50 text-indigo-700 dark:text-indigo-400 px-1.5 py-0.5 rounded",children:"Active"})]}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 font-mono truncate",children:_.path.replace(/^\/Users\/[^/]+/,"~")}),!_.exists&&n.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400 mt-1",children:"Path not found - the directory may have been moved or deleted"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[!_.isActive&&_.exists&&n.jsx(le,{size:"sm",onClick:()=>x(_.id),disabled:l===_.id,children:l===_.id?n.jsx(ut,{className:"w-4 h-4 animate-spin"}):"Select"}),n.jsx(le,{size:"sm",variant:"ghost",onClick:()=>w(_),className:"text-gray-500 dark:text-slate-400 hover:text-red-600 dark:hover:text-red-400",title:"Remove from registry",children:n.jsx(jn,{className:"w-4 h-4"})})]})]},_.id))})}),n.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[n.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),n.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[n.jsx("p",{children:"coder-config project add [path] # Add project"}),n.jsx("p",{children:"coder-config project remove <name> # Remove project"}),n.jsx("p",{children:"coder-config project # List projects"})]})]}),n.jsx(Mj,{open:f,onOpenChange:m,onAdded:k})]})}const dH=[{id:"getting-started",title:"Getting Started",icon:Li,subsections:[{id:"installation",title:"Installation"},{id:"quick-start",title:"Quick Start"},{id:"updating",title:"Updating"}]},{id:"projects",title:"Project Management",icon:Zs,subsections:[{id:"project-registry",title:"Project Registry"},{id:"project-switching",title:"Switching Projects"},{id:"project-structure",title:"Project Structure"}]},{id:"file-explorer",title:"Project Explorer",icon:wr,subsections:[{id:"claude-folders",title:".claude Folders"},{id:"rules",title:"Rules"},{id:"commands",title:"Commands"},{id:"workflows",title:"Workflows"},{id:"hierarchy",title:"Configuration Hierarchy"},{id:"subprojects",title:"Sub-Projects"}]},{id:"workstreams",title:"Workstreams",icon:Zs,isNew:!0,subsections:[{id:"workstreams-overview",title:"Overview"},{id:"creating-workstreams",title:"Creating Workstreams"},{id:"workstream-hooks",title:"Hook Integration"},{id:"activity-tracking",title:"Activity Tracking"}]},{id:"plugins",title:"Plugins",icon:ns,isNew:!0,subsections:[{id:"plugins-overview",title:"Overview"},{id:"installing-plugins",title:"Installing Plugins"},{id:"plugin-marketplaces",title:"Marketplaces"}]},{id:"mcp-registry",title:"MCP Registry",icon:ns,subsections:[{id:"mcp-overview",title:"Overview"},{id:"adding-mcps",title:"Adding MCPs"},{id:"configuring-mcps",title:"Configuring MCPs"},{id:"environment-vars",title:"Environment Variables"}]},{id:"memory",title:"Memory System",icon:Ii,subsections:[{id:"memory-overview",title:"Overview"},{id:"global-memory",title:"Global Memory"},{id:"project-memory",title:"Project Memory"},{id:"memory-entries",title:"Memory Entry Types"}]},{id:"claude-settings",title:"Claude Code Settings",icon:as,subsections:[{id:"permissions",title:"Permissions"},{id:"model-selection",title:"Model Selection"},{id:"behavior",title:"Behavior Settings"},{id:"hooks",title:"Hooks"}]},{id:"gemini-settings",title:"Gemini CLI Settings",icon:Ft,isNew:!0,subsections:[{id:"gemini-model",title:"Model Selection"},{id:"gemini-display",title:"Display Options"},{id:"gemini-general",title:"General Settings"},{id:"gemini-sandbox",title:"Sandbox Mode"}]},{id:"antigravity-settings",title:"Antigravity Settings",icon:wl,isNew:!0,subsections:[{id:"antigravity-security",title:"Security Policies"},{id:"antigravity-mcp",title:"MCP Servers"},{id:"antigravity-browser",title:"Browser Allowlist"},{id:"antigravity-agent",title:"Agent Mode"}]},{id:"cli",title:"CLI Reference",icon:Ft,subsections:[{id:"cli-overview",title:"Overview"},{id:"cli-commands",title:"All Commands"},{id:"daemon-mode",title:"Daemon Mode"}]},{id:"multi-tool",title:"Multi-Tool Support",icon:Ht,subsections:[{id:"supported-tools",title:"Supported Tools"},{id:"gemini-cli",title:"Gemini CLI"},{id:"antigravity",title:"Antigravity"},{id:"tool-differences",title:"Tool Differences"},{id:"enabling-tools",title:"Enabling Tools"},{id:"syncing-rules",title:"Syncing Rules"}]},{id:"keyboard",title:"Keyboard Shortcuts",icon:e5,subsections:[]},{id:"troubleshooting",title:"Troubleshooting",icon:Ku,subsections:[{id:"common-issues",title:"Common Issues"},{id:"getting-help",title:"Getting Help"}]}],hH={installation:{title:"Installation",content:`
|
|
631
631
|
## Installation
|
|
632
632
|
|
|
633
633
|
Choose your preferred installation method:
|
|
634
634
|
|
|
635
635
|
### Option A: Desktop App (Recommended)
|
|
636
636
|
|
|
637
|
-
Download the native app from [GitHub Releases](https://github.com/regression-io/
|
|
637
|
+
Download the native app from [GitHub Releases](https://github.com/regression-io/coder-config/releases):
|
|
638
638
|
|
|
639
639
|
| Platform | Download |
|
|
640
640
|
|----------|----------|
|
|
@@ -658,13 +658,13 @@ npm install -g coder-config
|
|
|
658
658
|
Verify installation:
|
|
659
659
|
|
|
660
660
|
\`\`\`bash
|
|
661
|
-
|
|
661
|
+
coder-config --version
|
|
662
662
|
\`\`\`
|
|
663
663
|
|
|
664
664
|
Then start the UI:
|
|
665
665
|
|
|
666
666
|
\`\`\`bash
|
|
667
|
-
|
|
667
|
+
coder-config ui
|
|
668
668
|
\`\`\`
|
|
669
669
|
`},"quick-start":{title:"Quick Start",content:`
|
|
670
670
|
## Quick Start
|
|
@@ -675,7 +675,7 @@ Claude Code works great out of the box. This tool helps you manage its configura
|
|
|
675
675
|
|
|
676
676
|
**Desktop App:** Double-click the app after installing from GitHub Releases.
|
|
677
677
|
|
|
678
|
-
**CLI:** Run \`
|
|
678
|
+
**CLI:** Run \`coder-config ui\` in your terminal.
|
|
679
679
|
|
|
680
680
|
### 2. Add Your Projects
|
|
681
681
|
|
|
@@ -707,7 +707,7 @@ Using the CLI version? The UI is a PWA - install it to your taskbar via Chrome/E
|
|
|
707
707
|
|
|
708
708
|
### Desktop App
|
|
709
709
|
|
|
710
|
-
Download the latest version from [GitHub Releases](https://github.com/regression-io/
|
|
710
|
+
Download the latest version from [GitHub Releases](https://github.com/regression-io/coder-config/releases) and install over your existing installation.
|
|
711
711
|
|
|
712
712
|
### npm Package
|
|
713
713
|
|
|
@@ -722,13 +722,13 @@ npm install -g coder-config@latest
|
|
|
722
722
|
**After updating (if using daemon mode):**
|
|
723
723
|
|
|
724
724
|
\`\`\`bash
|
|
725
|
-
|
|
726
|
-
|
|
725
|
+
coder-config ui stop
|
|
726
|
+
coder-config ui
|
|
727
727
|
\`\`\`
|
|
728
728
|
`}},fH={"project-registry":{title:"Project Registry",content:`
|
|
729
729
|
## Project Registry
|
|
730
730
|
|
|
731
|
-
The project registry keeps track of all your Claude-enabled projects. It's stored in \`~/.claude-config/projects.json
|
|
731
|
+
The project registry keeps track of all your Claude-enabled projects. It's stored in \`~/.coder-config/projects.json\` (or \`~/.claude-config/projects.json\` for legacy installs).
|
|
732
732
|
|
|
733
733
|
### Adding Projects
|
|
734
734
|
|
|
@@ -738,21 +738,21 @@ The project registry keeps track of all your Claude-enabled projects. It's store
|
|
|
738
738
|
|
|
739
739
|
**Via CLI:**
|
|
740
740
|
\`\`\`bash
|
|
741
|
-
|
|
742
|
-
|
|
741
|
+
coder-config project add /path/to/project
|
|
742
|
+
coder-config project add /path/to/project --name "My Project"
|
|
743
743
|
\`\`\`
|
|
744
744
|
|
|
745
745
|
### Listing Projects
|
|
746
746
|
|
|
747
747
|
\`\`\`bash
|
|
748
|
-
|
|
748
|
+
coder-config project
|
|
749
749
|
\`\`\`
|
|
750
750
|
|
|
751
751
|
### Removing Projects
|
|
752
752
|
|
|
753
753
|
\`\`\`bash
|
|
754
|
-
|
|
755
|
-
|
|
754
|
+
coder-config project remove "My Project"
|
|
755
|
+
coder-config project remove /path/to/project
|
|
756
756
|
\`\`\`
|
|
757
757
|
|
|
758
758
|
Note: Removing a project from the registry does not delete the project files.
|
|
@@ -776,7 +776,7 @@ The project dropdown in the header switches which project's **configuration** yo
|
|
|
776
776
|
|
|
777
777
|
\`\`\`bash
|
|
778
778
|
# Start UI for a specific project
|
|
779
|
-
|
|
779
|
+
coder-config ui /path/to/project
|
|
780
780
|
\`\`\`
|
|
781
781
|
|
|
782
782
|
The UI remembers your last active project between sessions.
|
|
@@ -807,7 +807,7 @@ your-project/
|
|
|
807
807
|
|
|
808
808
|
### Generated Files
|
|
809
809
|
|
|
810
|
-
The \`.mcp.json\` file in your project root is generated by running \`
|
|
810
|
+
The \`.mcp.json\` file in your project root is generated by running \`coder-config apply\`. Claude Code reads this file to configure MCPs.
|
|
811
811
|
`}},mH={"claude-folders":{title:".claude Folders",content:`
|
|
812
812
|
## .claude Folders
|
|
813
813
|
|
|
@@ -1051,32 +1051,32 @@ Each workstream has:
|
|
|
1051
1051
|
|
|
1052
1052
|
\`\`\`bash
|
|
1053
1053
|
# Create a workstream for your product
|
|
1054
|
-
|
|
1054
|
+
coder-config workstream create "Acme App"
|
|
1055
1055
|
|
|
1056
1056
|
# Add repos to it
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1057
|
+
coder-config workstream add "Acme App" ~/projects/acme-frontend
|
|
1058
|
+
coder-config workstream add "Acme App" ~/projects/acme-api
|
|
1059
|
+
coder-config workstream add "Acme App" ~/projects/acme-shared
|
|
1060
1060
|
|
|
1061
1061
|
# Activate it
|
|
1062
|
-
|
|
1062
|
+
coder-config workstream use "Acme App"
|
|
1063
1063
|
\`\`\`
|
|
1064
1064
|
|
|
1065
1065
|
### Managing Workstreams
|
|
1066
1066
|
|
|
1067
1067
|
**List all workstreams:**
|
|
1068
1068
|
\`\`\`bash
|
|
1069
|
-
|
|
1069
|
+
coder-config workstream
|
|
1070
1070
|
\`\`\`
|
|
1071
1071
|
|
|
1072
1072
|
**Show active workstream:**
|
|
1073
1073
|
\`\`\`bash
|
|
1074
|
-
|
|
1074
|
+
coder-config workstream active
|
|
1075
1075
|
\`\`\`
|
|
1076
1076
|
|
|
1077
1077
|
**Delete a workstream:**
|
|
1078
1078
|
\`\`\`bash
|
|
1079
|
-
|
|
1079
|
+
coder-config workstream delete "Acme App"
|
|
1080
1080
|
\`\`\`
|
|
1081
1081
|
|
|
1082
1082
|
### Editing Rules
|
|
@@ -1110,7 +1110,7 @@ Add to \`~/.claude/hooks/pre-prompt.sh\`:
|
|
|
1110
1110
|
|
|
1111
1111
|
\`\`\`bash
|
|
1112
1112
|
#!/bin/bash
|
|
1113
|
-
|
|
1113
|
+
coder-config workstream inject --silent
|
|
1114
1114
|
\`\`\`
|
|
1115
1115
|
|
|
1116
1116
|
Make it executable:
|
|
@@ -1129,10 +1129,10 @@ chmod +x ~/.claude/hooks/pre-prompt.sh
|
|
|
1129
1129
|
|
|
1130
1130
|
\`\`\`bash
|
|
1131
1131
|
# See what would be injected
|
|
1132
|
-
|
|
1132
|
+
coder-config workstream inject
|
|
1133
1133
|
|
|
1134
1134
|
# Silent mode (no output if no workstream)
|
|
1135
|
-
|
|
1135
|
+
coder-config workstream inject --silent
|
|
1136
1136
|
\`\`\`
|
|
1137
1137
|
|
|
1138
1138
|
### Auto-Detection
|
|
@@ -1140,7 +1140,7 @@ claude-config workstream inject --silent
|
|
|
1140
1140
|
Claude-config can also detect which workstream to use based on your current directory:
|
|
1141
1141
|
|
|
1142
1142
|
\`\`\`bash
|
|
1143
|
-
|
|
1143
|
+
coder-config workstream detect /path/to/project
|
|
1144
1144
|
\`\`\`
|
|
1145
1145
|
`},"activity-tracking":{title:"Activity Tracking",content:`
|
|
1146
1146
|
## Activity Tracking
|
|
@@ -1159,7 +1159,7 @@ Add to \`~/.claude/hooks/post-response.sh\`:
|
|
|
1159
1159
|
|
|
1160
1160
|
\`\`\`bash
|
|
1161
1161
|
#!/bin/bash
|
|
1162
|
-
source /path/to/
|
|
1162
|
+
source /path/to/coder-config/hooks/activity-track.sh
|
|
1163
1163
|
\`\`\`
|
|
1164
1164
|
|
|
1165
1165
|
Or use the one-click install in the Workstreams view.
|
|
@@ -1174,7 +1174,7 @@ In the **Workstreams** view, the Activity Insights panel shows:
|
|
|
1174
1174
|
|
|
1175
1175
|
### Workstream Suggestions
|
|
1176
1176
|
|
|
1177
|
-
Based on co-activity patterns,
|
|
1177
|
+
Based on co-activity patterns, coder-config suggests workstreams:
|
|
1178
1178
|
|
|
1179
1179
|
- **Co-activity score** - Percentage showing how often projects are worked on together
|
|
1180
1180
|
- **Create button** - Opens pre-filled dialog (tweak projects as needed)
|
|
@@ -1182,7 +1182,7 @@ Based on co-activity patterns, claude-config suggests workstreams:
|
|
|
1182
1182
|
|
|
1183
1183
|
### Privacy
|
|
1184
1184
|
|
|
1185
|
-
- Activity data is stored locally in \`~/.
|
|
1185
|
+
- Activity data is stored locally in \`~/.coder-config/activity.json\`
|
|
1186
1186
|
- Only file paths are logged (not file contents)
|
|
1187
1187
|
- You can delete the activity file at any time
|
|
1188
1188
|
- Activity tracking is read-only and never modifies your code
|
|
@@ -1389,7 +1389,7 @@ Both formats work:
|
|
|
1389
1389
|
### Via CLI
|
|
1390
1390
|
|
|
1391
1391
|
\`\`\`bash
|
|
1392
|
-
|
|
1392
|
+
coder-config add filesystem github postgres
|
|
1393
1393
|
\`\`\`
|
|
1394
1394
|
|
|
1395
1395
|
### From Search Results
|
|
@@ -1885,19 +1885,19 @@ Agent mode can make many changes quickly. Use with code review policy enabled.
|
|
|
1885
1885
|
`}},_H={"cli-overview":{title:"CLI Overview",content:`
|
|
1886
1886
|
## CLI Overview
|
|
1887
1887
|
|
|
1888
|
-
The \`
|
|
1888
|
+
The \`coder-config\` CLI provides command-line access to all features.
|
|
1889
1889
|
|
|
1890
1890
|
### Basic Usage
|
|
1891
1891
|
|
|
1892
1892
|
\`\`\`bash
|
|
1893
|
-
|
|
1893
|
+
coder-config [command] [options]
|
|
1894
1894
|
\`\`\`
|
|
1895
1895
|
|
|
1896
1896
|
### Getting Help
|
|
1897
1897
|
|
|
1898
1898
|
\`\`\`bash
|
|
1899
|
-
|
|
1900
|
-
|
|
1899
|
+
coder-config --help
|
|
1900
|
+
coder-config <command> --help
|
|
1901
1901
|
\`\`\`
|
|
1902
1902
|
|
|
1903
1903
|
### Global Options
|
|
@@ -1910,87 +1910,87 @@ claude-config <command> --help
|
|
|
1910
1910
|
### UI Commands
|
|
1911
1911
|
|
|
1912
1912
|
\`\`\`bash
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1913
|
+
coder-config ui # Start UI (daemon mode)
|
|
1914
|
+
coder-config ui --foreground # Run in foreground
|
|
1915
|
+
coder-config ui --port 8080 # Custom port
|
|
1916
|
+
coder-config ui status # Check daemon status
|
|
1917
|
+
coder-config ui stop # Stop daemon
|
|
1918
1918
|
\`\`\`
|
|
1919
1919
|
|
|
1920
1920
|
### Project Commands
|
|
1921
1921
|
|
|
1922
1922
|
\`\`\`bash
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1923
|
+
coder-config init # Initialize project
|
|
1924
|
+
coder-config init --template X # Initialize with template
|
|
1925
|
+
coder-config apply # Generate .mcp.json
|
|
1926
|
+
coder-config show # Show configuration
|
|
1927
1927
|
\`\`\`
|
|
1928
1928
|
|
|
1929
1929
|
### MCP Commands
|
|
1930
1930
|
|
|
1931
1931
|
\`\`\`bash
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1932
|
+
coder-config list # List available MCPs
|
|
1933
|
+
coder-config add <mcp> # Add MCP to project
|
|
1934
|
+
coder-config remove <mcp> # Remove MCP
|
|
1935
|
+
coder-config registry # List registry
|
|
1936
|
+
coder-config registry add <name> '{}' # Add to registry
|
|
1937
|
+
coder-config registry remove <name> # Remove from registry
|
|
1938
1938
|
\`\`\`
|
|
1939
1939
|
|
|
1940
1940
|
### Project Registry
|
|
1941
1941
|
|
|
1942
1942
|
\`\`\`bash
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1943
|
+
coder-config project # List projects
|
|
1944
|
+
coder-config project add # Add project
|
|
1945
|
+
coder-config project remove # Remove project
|
|
1946
1946
|
\`\`\`
|
|
1947
1947
|
|
|
1948
1948
|
### Memory Commands
|
|
1949
1949
|
|
|
1950
1950
|
\`\`\`bash
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1951
|
+
coder-config memory # Show memory status
|
|
1952
|
+
coder-config memory init # Initialize memory
|
|
1953
|
+
coder-config memory add # Add entry
|
|
1954
|
+
coder-config memory search # Search memory
|
|
1955
1955
|
\`\`\`
|
|
1956
1956
|
|
|
1957
1957
|
### Environment
|
|
1958
1958
|
|
|
1959
1959
|
\`\`\`bash
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1960
|
+
coder-config env # List variables
|
|
1961
|
+
coder-config env set KEY value # Set variable
|
|
1962
|
+
coder-config env unset KEY # Remove variable
|
|
1963
1963
|
\`\`\`
|
|
1964
1964
|
|
|
1965
1965
|
### Templates
|
|
1966
1966
|
|
|
1967
1967
|
\`\`\`bash
|
|
1968
|
-
|
|
1969
|
-
|
|
1968
|
+
coder-config templates # List templates
|
|
1969
|
+
coder-config apply-template X # Apply template
|
|
1970
1970
|
\`\`\`
|
|
1971
1971
|
|
|
1972
1972
|
### Workstreams
|
|
1973
1973
|
|
|
1974
1974
|
\`\`\`bash
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1975
|
+
coder-config workstream # List workstreams
|
|
1976
|
+
coder-config workstream create "X" # Create workstream
|
|
1977
|
+
coder-config workstream delete "X" # Delete workstream
|
|
1978
|
+
coder-config workstream use "X" # Set active
|
|
1979
|
+
coder-config workstream active # Show active
|
|
1980
|
+
coder-config workstream add "X" /path # Add project
|
|
1981
|
+
coder-config workstream remove "X" /path # Remove project
|
|
1982
|
+
coder-config workstream inject # Output rules for hooks
|
|
1983
|
+
coder-config workstream detect # Detect from directory
|
|
1984
1984
|
\`\`\`
|
|
1985
1985
|
`},"daemon-mode":{title:"Daemon Mode",content:`
|
|
1986
1986
|
## Daemon Mode
|
|
1987
1987
|
|
|
1988
|
-
By default, \`
|
|
1988
|
+
By default, \`coder-config ui\` runs as a background daemon.
|
|
1989
1989
|
|
|
1990
1990
|
### Starting the Daemon
|
|
1991
1991
|
|
|
1992
1992
|
\`\`\`bash
|
|
1993
|
-
|
|
1993
|
+
coder-config ui
|
|
1994
1994
|
\`\`\`
|
|
1995
1995
|
|
|
1996
1996
|
The UI starts in the background and you can continue using your terminal.
|
|
@@ -1998,13 +1998,13 @@ The UI starts in the background and you can continue using your terminal.
|
|
|
1998
1998
|
### Checking Status
|
|
1999
1999
|
|
|
2000
2000
|
\`\`\`bash
|
|
2001
|
-
|
|
2001
|
+
coder-config ui status
|
|
2002
2002
|
\`\`\`
|
|
2003
2003
|
|
|
2004
2004
|
### Stopping the Daemon
|
|
2005
2005
|
|
|
2006
2006
|
\`\`\`bash
|
|
2007
|
-
|
|
2007
|
+
coder-config ui stop
|
|
2008
2008
|
\`\`\`
|
|
2009
2009
|
|
|
2010
2010
|
### Foreground Mode
|
|
@@ -2012,18 +2012,18 @@ claude-config ui stop
|
|
|
2012
2012
|
To run in the foreground (blocking):
|
|
2013
2013
|
|
|
2014
2014
|
\`\`\`bash
|
|
2015
|
-
|
|
2015
|
+
coder-config ui --foreground
|
|
2016
2016
|
# or
|
|
2017
|
-
|
|
2017
|
+
coder-config ui -f
|
|
2018
2018
|
\`\`\`
|
|
2019
2019
|
|
|
2020
2020
|
### Logs
|
|
2021
2021
|
|
|
2022
|
-
Daemon logs are stored in \`~/.
|
|
2022
|
+
Daemon logs are stored in \`~/.coder-config/ui.log\`
|
|
2023
2023
|
`}},SH={"supported-tools":{title:"Supported Tools",content:`
|
|
2024
2024
|
## Supported AI Coding Tools
|
|
2025
2025
|
|
|
2026
|
-
|
|
2026
|
+
coder-config supports multiple AI coding assistants:
|
|
2027
2027
|
|
|
2028
2028
|
| Tool | Type | Config Location |
|
|
2029
2029
|
|------|------|-----------------|
|
|
@@ -2033,7 +2033,7 @@ claude-config supports multiple AI coding assistants:
|
|
|
2033
2033
|
|
|
2034
2034
|
### Shared MCP Registry
|
|
2035
2035
|
|
|
2036
|
-
All tools use the **MCP (Model Context Protocol)** for server configurations.
|
|
2036
|
+
All tools use the **MCP (Model Context Protocol)** for server configurations. coder-config maintains a shared registry and generates tool-specific output files.
|
|
2037
2037
|
|
|
2038
2038
|
### Enabling Tools
|
|
2039
2039
|
|
|
@@ -2116,7 +2116,7 @@ Antigravity MCP config is stored at \`~/.gemini/antigravity/mcp_config.json\`:
|
|
|
2116
2116
|
|
|
2117
2117
|
**Important**: Antigravity does NOT support \`\${VAR}\` interpolation.
|
|
2118
2118
|
|
|
2119
|
-
When generating Antigravity configs,
|
|
2119
|
+
When generating Antigravity configs, coder-config automatically resolves all environment variables to their actual values.
|
|
2120
2120
|
|
|
2121
2121
|
Example:
|
|
2122
2122
|
- Claude Code: \`"path": "\${HOME}/projects"\`
|
|
@@ -2192,7 +2192,7 @@ When you click **Apply Config**:
|
|
|
2192
2192
|
|
|
2193
2193
|
### Config File
|
|
2194
2194
|
|
|
2195
|
-
Tool preferences are stored in \`~/.
|
|
2195
|
+
Tool preferences are stored in \`~/.coder-config/config.json\`:
|
|
2196
2196
|
|
|
2197
2197
|
\`\`\`json
|
|
2198
2198
|
{
|
|
@@ -2267,12 +2267,12 @@ Rules can be synced in any direction between these three tools.
|
|
|
2267
2267
|
|
|
2268
2268
|
### UI won't start
|
|
2269
2269
|
|
|
2270
|
-
**Symptom**: \`
|
|
2270
|
+
**Symptom**: \`coder-config ui\` shows "Started daemon" but the UI doesn't open.
|
|
2271
2271
|
|
|
2272
2272
|
**Solution**:
|
|
2273
2273
|
\`\`\`bash
|
|
2274
|
-
|
|
2275
|
-
|
|
2274
|
+
coder-config ui stop
|
|
2275
|
+
coder-config ui --foreground
|
|
2276
2276
|
\`\`\`
|
|
2277
2277
|
|
|
2278
2278
|
Check for errors in the output.
|
|
@@ -2283,7 +2283,7 @@ Check for errors in the output.
|
|
|
2283
2283
|
|
|
2284
2284
|
**Solution**:
|
|
2285
2285
|
\`\`\`bash
|
|
2286
|
-
|
|
2286
|
+
coder-config ui --port 3334
|
|
2287
2287
|
\`\`\`
|
|
2288
2288
|
|
|
2289
2289
|
Or find and stop the process using port 3333.
|
|
@@ -2293,7 +2293,7 @@ Or find and stop the process using port 3333.
|
|
|
2293
2293
|
**Symptom**: MCPs show in config but aren't available in Claude Code.
|
|
2294
2294
|
|
|
2295
2295
|
**Solution**:
|
|
2296
|
-
1. Run \`
|
|
2296
|
+
1. Run \`coder-config apply\` to regenerate .mcp.json
|
|
2297
2297
|
2. Restart Claude Code
|
|
2298
2298
|
3. Check environment variables are set
|
|
2299
2299
|
|
|
@@ -2304,7 +2304,7 @@ Or find and stop the process using port 3333.
|
|
|
2304
2304
|
**Solution**:
|
|
2305
2305
|
\`\`\`bash
|
|
2306
2306
|
npm cache clean --force
|
|
2307
|
-
npm install -g
|
|
2307
|
+
npm install -g coder-config
|
|
2308
2308
|
\`\`\`
|
|
2309
2309
|
`},"getting-help":{title:"Getting Help",content:`
|
|
2310
2310
|
## Getting Help
|
|
@@ -2316,18 +2316,18 @@ This documentation is available in the app under **Docs & Help**.
|
|
|
2316
2316
|
### GitHub Issues
|
|
2317
2317
|
|
|
2318
2318
|
Report bugs and request features:
|
|
2319
|
-
https://github.com/regression-io/
|
|
2319
|
+
https://github.com/regression-io/coder-config/issues
|
|
2320
2320
|
|
|
2321
2321
|
### Version Info
|
|
2322
2322
|
|
|
2323
2323
|
\`\`\`bash
|
|
2324
|
-
|
|
2324
|
+
coder-config --version
|
|
2325
2325
|
\`\`\`
|
|
2326
2326
|
|
|
2327
2327
|
### Debug Info
|
|
2328
2328
|
|
|
2329
2329
|
When reporting issues, include:
|
|
2330
|
-
-
|
|
2330
|
+
- coder-config version
|
|
2331
2331
|
- Node.js version (\`node --version\`)
|
|
2332
2332
|
- Operating system
|
|
2333
2333
|
- Error messages or logs
|
|
@@ -2336,7 +2336,7 @@ When reporting issues, include:
|
|
|
2336
2336
|
|
|
2337
2337
|
These projects are frequently worked on together.`),f(!0)},ye=Z=>{T(Pe=>Pe.filter(Le=>Le!==Z))},Oe=Z=>{P.includes(Z)||T(Pe=>[...Pe,Z])},Ve=async Z=>{const Pe=$[Z];if(!Pe&&!Y[Z]){G(Le=>({...Le,[Z]:!0}));try{const Le=await ke.getSubprojects(Z);z(st=>({...st,[Z]:Le.subprojects||[]}))}catch(Le){console.error("Failed to load subprojects:",Le),z(st=>({...st,[Z]:[]}))}finally{G(Le=>({...Le,[Z]:!1}))}}W(Le=>({...Le,[Z]:!Pe}))},re=Z=>{const Pe=Z.projects.sort().join("|"),Le=[...H,Pe];ae(Le),localStorage.setItem("dismissedWorkstreamSuggestions",JSON.stringify(Le)),fe(st=>st.filter(et=>et.projects.sort().join("|")!==Pe)),ee.success("Suggestion dismissed")},de=oe.filter(Z=>{const Pe=Z.projects.sort().join("|");return!H.includes(Pe)}),De=async()=>{if(confirm("Clear activity data older than 30 days?"))try{const Z=await ke.clearActivity(30);Z.success&&(ee.success(`Cleared ${Z.cleared} old entries`),J())}catch(Z){ee.error("Failed to clear activity: "+Z.message)}},Re=async()=>{B(!0);try{const Z=await ke.installWorkstreamHook();Z.success?(ee.success(Z.message),L(Pe=>({...Pe,isInstalled:!0}))):ee.error(Z.error||"Failed to install hook")}catch(Z){ee.error("Failed to install hook: "+Z.message)}finally{B(!1)}},Ze=async()=>{try{u(!0);const Z=await ke.getWorkstreams();s(Z.workstreams||[])}catch{ee.error("Failed to load workstreams")}finally{u(!1)}},Se=async()=>{if(!g.trim()){ee.error("Name is required");return}R(!0);try{const Z=await ke.createWorkstream(g.trim(),P,j);Z.success?(s(Pe=>[...Pe,Z.workstream]),ee.success(`Created workstream: ${g}`),f(!1),y(""),E(""),T([]),fe(Pe=>Pe.filter(Le=>Le.name!==g.trim()))):ee.error(Z.error||"Failed to create workstream")}catch(Z){ee.error("Failed to create workstream: "+Z.message)}finally{R(!1)}},ge=async Z=>{if(confirm(`Delete workstream "${Z.name}"?
|
|
2338
2338
|
|
|
2339
|
-
This cannot be undone.`))try{const Pe=await ke.deleteWorkstream(Z.id);Pe.success?(s(Le=>Le.filter(st=>st.id!==Z.id)),ee.success(`Deleted workstream: ${Z.name}`)):ee.error(Pe.error||"Failed to delete workstream")}catch(Pe){ee.error("Failed to delete workstream: "+Pe.message)}},Me=async()=>{if(m){R(!0);try{const Z=await ke.updateWorkstream(m.id,{name:m.name,rules:m.rules,projects:m.projects||[]});Z.success?(s(Pe=>Pe.map(Le=>Le.id===m.id?Z.workstream:Le)),ee.success("Workstream updated"),h(null)):ee.error(Z.error||"Failed to update workstream")}catch(Z){ee.error("Failed to update workstream: "+Z.message)}finally{R(!1)}}},ht=Z=>{b(Pe=>{const Le=new Set(Pe);return Le.has(Z)?Le.delete(Z):Le.add(Z),Le})},Rt=async()=>{if(!k||v.size===0)return;R(!0);let Z=0,Pe=null;for(const Le of v)try{const st=await ke.addProjectToWorkstream(k.id,Le);st.success&&(Pe=st.workstream,Z++)}catch(st){console.error("Failed to add project:",Le,st)}Pe&&s(Le=>Le.map(st=>st.id===k.id?Pe:st)),Z>0?ee.success(`Added ${Z} project${Z>1?"s":""} to ${k.name}`):ee.error("Failed to add projects"),R(!1),w(!1),_(null),b(new Set)},pe=async(Z,Pe)=>{try{const Le=await ke.removeProjectFromWorkstream(Z.id,Pe);Le.success?(s(st=>st.map(et=>et.id===Z.id?Le.workstream:et)),ee.success(`Removed project from ${Z.name}`)):ee.error(Le.error||"Failed to remove project")}catch(Le){ee.error("Failed to remove project: "+Le.message)}},be=Z=>Z.split("/").pop()||Z,Be=Z=>r.filter(Pe=>{var Le;return(Le=Pe.projects)==null?void 0:Le.includes(Z)}).length,Ge=(Z,Pe=null)=>{var et,jt;const Le=Be(Z),st=Pe?(jt=(et=r.find(ft=>ft.id===Pe))==null?void 0:et.projects)==null?void 0:jt.includes(Z):!1;return Le===0?null:Le===1?st?null:"in use":"shared"};return o?n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx(ut,{className:"w-8 h-8 animate-spin text-indigo-600"})}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-100 dark:bg-purple-900/30 flex items-center justify-center",children:n.jsx(Zs,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Workstreams"}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:"Context sets for multi-project workflows"})]})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(le,{variant:"outline",onClick:Ze,size:"sm",children:[n.jsx(pr,{className:"w-4 h-4 mr-2"}),"Refresh"]}),n.jsxs(le,{onClick:()=>f(!0),className:"bg-purple-600 hover:bg-purple-700",children:[n.jsx(yt,{className:"w-4 h-4 mr-2"}),"New Workstream"]})]})]}),n.jsxs("div",{className:"bg-purple-50 dark:bg-purple-950/30 border border-purple-200 dark:border-purple-800 rounded-lg p-4 text-sm text-purple-700 dark:text-purple-400",children:[n.jsx("p",{className:"font-medium mb-1",children:"What are Workstreams?"}),n.jsx("p",{children:"Workstreams are virtual projects that group repos belonging to the same product. When active, workstream rules are automatically injected into every Claude session."})]}),n.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm overflow-hidden",children:r.length===0?n.jsxs("div",{className:"p-12 text-center",children:[n.jsx(Zs,{className:"w-12 h-12 mx-auto mb-4 text-gray-300 dark:text-slate-600"}),n.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"No Workstreams Yet"}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 mb-4",children:"Create your first workstream to organize multi-project contexts."}),n.jsxs(le,{onClick:()=>f(!0),children:[n.jsx(yt,{className:"w-4 h-4 mr-2"}),"Create Your First Workstream"]})]}):n.jsx("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:r.map(Z=>{var Pe,Le,st;return n.jsxs("div",{className:"group",children:[n.jsxs("div",{className:"p-4 flex items-center gap-4 transition-colors cursor-pointer hover:bg-gray-50 dark:hover:bg-slate-900",onClick:()=>l(d===Z.id?null:Z.id),children:[n.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-400",children:d===Z.id?n.jsx(Sr,{className:"w-4 h-4"}):n.jsx(Kr,{className:"w-4 h-4"})}),n.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center bg-gray-100 dark:bg-slate-800",children:n.jsx(Zs,{className:"w-5 h-5 text-gray-500 dark:text-slate-400"})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h3",{className:"font-medium truncate text-gray-900 dark:text-white",children:Z.name}),((Pe=Z.projects)==null?void 0:Pe.length)>0&&n.jsxs("span",{className:"text-xs bg-gray-100 dark:bg-slate-800 text-gray-600 dark:text-slate-400 px-1.5 py-0.5 rounded",children:[Z.projects.length," project",Z.projects.length!==1?"s":""]}),Z.rules&&n.jsxs("span",{className:"text-xs bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 px-1.5 py-0.5 rounded",children:[n.jsx(Cr,{className:"w-3 h-3 inline mr-0.5"}),"Rules"]})]}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 truncate",children:((Le=Z.projects)==null?void 0:Le.length)>0?Z.projects.map(et=>be(et)).join(", "):"No projects added"})]}),n.jsxs("div",{className:"flex items-center gap-2",onClick:et=>et.stopPropagation(),children:[n.jsx(le,{size:"sm",variant:"ghost",onClick:()=>h({...Z}),className:"text-gray-500 dark:text-slate-400 hover:text-purple-600 dark:hover:text-purple-400",title:"Edit workstream",children:n.jsx(nb,{className:"w-4 h-4"})}),n.jsx(le,{size:"sm",variant:"ghost",onClick:()=>ge(Z),className:"text-gray-500 dark:text-slate-400 hover:text-red-600 dark:hover:text-red-400",title:"Delete workstream",children:n.jsx(jn,{className:"w-4 h-4"})})]})]}),d===Z.id&&n.jsxs("div",{className:"px-4 pb-4 pl-16 space-y-4 bg-gray-50/50 dark:bg-slate-900/50",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),n.jsxs(le,{size:"sm",variant:"outline",onClick:()=>{_(Z),w(!0)},children:[n.jsx(Mi,{className:"w-4 h-4 mr-1"}),"Add Project"]})]}),((st=Z.projects)==null?void 0:st.length)>0?n.jsx("div",{className:"space-y-1",children:Z.projects.map(et=>n.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[n.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:et.replace(/^\/Users\/[^/]+/,"~")}),n.jsx(le,{size:"sm",variant:"ghost",onClick:()=>pe(Z,et),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:n.jsx($M,{className:"w-4 h-4"})})]},et))}):n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic",children:"No projects added yet. Add projects to help organize your workstream."})]}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:"Rules"}),Z.rules?n.jsx("pre",{className:"text-sm text-gray-600 dark:text-slate-400 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700 p-3 overflow-auto max-h-40 whitespace-pre-wrap",children:Z.rules}):n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic",children:"No rules defined. Click Edit to add context rules for this workstream."})]})]})]},Z.id)})})}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Hook Integration"}),n.jsx(zo,{children:n.jsxs(on,{children:[n.jsx(an,{asChild:!0,children:n.jsx("button",{className:"text-gray-400 hover:text-gray-600 dark:hover:text-slate-300",children:n.jsx(Ku,{className:"w-4 h-4"})})}),n.jsx(qr,{side:"right",className:"max-w-xs",children:n.jsxs("p",{className:"text-sm",children:[n.jsx("strong",{children:"What are hooks?"}),n.jsx("br",{}),n.jsx("br",{}),"Hooks are scripts that run automatically at specific points in Claude Code sessions. The workstream hook runs before each prompt and injects your active workstream's rules into the context.",n.jsx("br",{}),n.jsx("br",{}),n.jsx("strong",{children:"How it works:"}),n.jsx("br",{}),"1. You activate a workstream",n.jsx("br",{}),"2. Hook detects the active workstream",n.jsx("br",{}),"3. Rules are prepended to Claude's context",n.jsx("br",{}),"4. Claude understands your project context"]})})]})})]}),U.isInstalled?n.jsx("div",{className:"bg-green-50 dark:bg-green-950/30 border border-green-200 dark:border-green-800 rounded-lg p-4 text-sm text-green-700 dark:text-green-400",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Em,{className:"w-5 h-5 flex-shrink-0"}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium",children:"Hook Installed"}),n.jsx("p",{className:"text-green-600 dark:text-green-500",children:"Workstream rules will be automatically injected into every Claude session."})]})]})}):n.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg p-4 text-sm text-amber-700 dark:text-amber-400",children:n.jsxs("div",{className:"flex gap-3",children:[n.jsx(Oi,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"font-medium mb-1",children:"Hook Not Installed"}),n.jsx("p",{className:"mb-3",children:"Install the pre-prompt hook to automatically inject workstream rules into every Claude session."}),n.jsxs(le,{onClick:Re,disabled:M||U.loading,size:"sm",className:"bg-amber-600 hover:bg-amber-700 text-white",children:[M?n.jsx(ut,{className:"w-4 h-4 animate-spin mr-2"}):n.jsx(bl,{className:"w-4 h-4 mr-2"}),"Install Hook"]}),n.jsxs("p",{className:"text-xs mt-2 text-amber-600 dark:text-amber-500",children:["Creates ",n.jsx("code",{className:"bg-amber-100 dark:bg-amber-900/50 px-1 rounded",children:"~/.claude/hooks/pre-prompt.sh"})]})]})]})})]}),q&&q.totalSessions>0&&n.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm p-4",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(X4,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"}),n.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Activity Insights"})]}),n.jsxs(le,{variant:"ghost",size:"sm",onClick:De,className:"text-gray-500 dark:text-slate-400 hover:text-red-500",children:[n.jsx(jn,{className:"w-4 h-4 mr-1"}),"Clear Old"]})]}),n.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-4",children:[n.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[n.jsx(b1,{className:"w-3 h-3"}),"Sessions"]}),n.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:q.totalSessions})]}),n.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[n.jsx(Cr,{className:"w-3 h-3"}),"Files Tracked"]}),n.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:q.totalFiles})]}),n.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[n.jsx(Zs,{className:"w-3 h-3"}),"Projects Active"]}),n.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:q.projectCount})]})]}),((Ke=q.topProjects)==null?void 0:Ke.length)>0&&n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:"Most Active Projects"}),n.jsx("div",{className:"space-y-1",children:q.topProjects.slice(0,5).map((Z,Pe)=>n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsx("span",{className:"text-gray-600 dark:text-slate-400 truncate",title:Z.path,children:Z.path.split("/").pop()}),n.jsxs("span",{className:"text-gray-400 dark:text-slate-500 text-xs",children:[Z.fileCount," files"]})]},Z.path))})]})]}),de.length>0&&n.jsxs("div",{className:"bg-gradient-to-r from-indigo-50 to-purple-50 dark:from-indigo-950/30 dark:to-purple-950/30 rounded-xl border border-indigo-200 dark:border-indigo-800 p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsx(Ht,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"}),n.jsx("h3",{className:"font-medium text-indigo-900 dark:text-indigo-300",children:"Suggested Workstreams"}),n.jsx("span",{className:"text-xs bg-indigo-100 dark:bg-indigo-900/50 text-indigo-600 dark:text-indigo-400 px-1.5 py-0.5 rounded",children:"Based on activity patterns"})]}),n.jsx("p",{className:"text-sm text-indigo-700 dark:text-indigo-400 mb-4",children:"These projects are frequently worked on together. Create a workstream to group them?"}),n.jsx("div",{className:"space-y-3",children:de.map(Z=>n.jsxs("div",{className:"bg-white dark:bg-slate-900 rounded-lg border border-indigo-200 dark:border-indigo-800 p-3",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ju,{className:"w-4 h-4 text-amber-500"}),n.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Z.name}),Z.coActivityScore&&n.jsxs("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:[Z.coActivityScore,"% co-activity"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(le,{size:"sm",variant:"ghost",onClick:()=>re(Z),className:"text-gray-400 hover:text-gray-600 dark:hover:text-slate-300",title:"Dismiss suggestion",children:n.jsx(ei,{className:"w-4 h-4"})}),n.jsxs(le,{size:"sm",onClick:()=>ie(Z),className:"bg-indigo-600 hover:bg-indigo-700",children:[n.jsx(yt,{className:"w-4 h-4 mr-1"}),"Create"]})]})]}),n.jsx("div",{className:"flex flex-wrap gap-1",children:Z.projects.map(Pe=>n.jsx("span",{className:"text-xs bg-gray-100 dark:bg-slate-800 text-gray-600 dark:text-slate-400 px-2 py-0.5 rounded",children:Pe.split("/").pop()},Pe))})]},Z.name))})]}),n.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[n.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),n.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[n.jsx("p",{children:"claude-config workstream # List workstreams"}),n.jsx("p",{children:'claude-config workstream use "Name" # Set workstream for this tab'}),n.jsx("p",{children:'claude-config workstream create "Name" # Create workstream'})]})]}),n.jsx(Tt,{open:c,onOpenChange:Z=>{Z||(f(!1),y(""),E(""),T([]),O(!1),W({}))},children:n.jsxs(St,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[n.jsx(Ct,{children:n.jsxs(kt,{className:"flex items-center gap-2",children:[n.jsx(Zs,{className:"w-5 h-5 text-purple-600"}),"Create Workstream"]})}),n.jsxs("div",{className:"space-y-4 py-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Name"}),n.jsx(ct,{value:g,onChange:Z=>y(Z.target.value),placeholder:"e.g., User Auth, Admin Dashboard",autoFocus:!0})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),n.jsxs(le,{type:"button",size:"sm",variant:"outline",onClick:()=>O(!I),children:[n.jsx(Mi,{className:"w-4 h-4 mr-1"}),"Add"]})]}),P.length>0?n.jsx("div",{className:"space-y-1 mb-2",children:P.map(Z=>n.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-gray-50 dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[n.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:Z.replace(/^\/Users\/[^/]+/,"~")}),n.jsx(le,{type:"button",size:"sm",variant:"ghost",onClick:()=>ye(Z),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:n.jsx(ei,{className:"w-4 h-4"})})]},Z))}):n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic mb-2",children:"No projects added. Add projects to help organize your workstream."}),I&&e.length>0&&n.jsx("div",{className:"border border-gray-200 dark:border-slate-700 rounded-lg p-2 max-h-64 overflow-y-auto bg-white dark:bg-slate-900",children:e.map(Z=>{const Pe=Ge(Z.path),Le=$[Z.path],st=K[Z.path],et=Y[Z.path]||[],jt=P.includes(Z.path);return n.jsxs("div",{className:"mb-1",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",onClick:()=>Ve(Z.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:st?n.jsx(ut,{className:"w-4 h-4 animate-spin text-gray-400"}):Le?n.jsx(Sr,{className:"w-4 h-4 text-gray-400"}):n.jsx(Kr,{className:"w-4 h-4 text-gray-400"})}),n.jsxs("button",{type:"button",onClick:()=>Oe(Z.path),disabled:jt,className:`flex-1 text-left p-2 rounded transition-colors ${jt?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Z.name}),n.jsxs("div",{className:"flex items-center gap-1",children:[Pe&&n.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Pe==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:Pe}),jt&&n.jsx(Kt,{className:"w-4 h-4 text-purple-600"})]})]}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:Z.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),Le&&et.length>0&&n.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:et.map(ft=>{const wt=P.includes(ft.dir),Vt=Ge(ft.dir);return n.jsxs("button",{type:"button",onClick:()=>Oe(ft.dir),disabled:wt,className:`w-full text-left p-2 rounded transition-colors ${wt?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:ft.name}),n.jsxs("div",{className:"flex items-center gap-1",children:[Vt&&n.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Vt==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:Vt}),wt&&n.jsx(Kt,{className:"w-4 h-4 text-purple-600"})]})]}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono",children:ft.relativePath})]},ft.dir)})}),Le&&et.length===0&&!st&&n.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},Z.id)})})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Context (optional)"}),n.jsx(pt,{value:j,onChange:Z=>E(Z.target.value),placeholder:"Context rules for this workstream. These will be injected into every Claude session when this workstream is active.",rows:6}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:'Example: "Focus on user authentication. Use JWT tokens. React Query for state management."'})]})]}),n.jsxs(It,{children:[n.jsx(le,{variant:"outline",onClick:()=>{f(!1),y(""),E(""),T([]),O(!1),W({})},children:"Cancel"}),n.jsxs(le,{onClick:Se,disabled:N||!g.trim(),className:"bg-purple-600 hover:bg-purple-700",children:[N?n.jsx(ut,{className:"w-4 h-4 animate-spin mr-2"}):n.jsx(yt,{className:"w-4 h-4 mr-2"}),"Create"]})]})]})}),n.jsx(Tt,{open:!!m,onOpenChange:Z=>!Z&&h(null),children:n.jsxs(St,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[n.jsx(Ct,{children:n.jsxs(kt,{className:"flex items-center gap-2",children:[n.jsx(nb,{className:"w-5 h-5 text-purple-600"}),"Edit Workstream"]})}),m&&n.jsxs("div",{className:"space-y-4 py-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Name"}),n.jsx(ct,{value:m.name,onChange:Z=>h(Pe=>({...Pe,name:Z.target.value}))})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),n.jsxs(le,{type:"button",size:"sm",variant:"outline",onClick:()=>h(Z=>({...Z,showPicker:!Z.showPicker})),children:[n.jsx(Mi,{className:"w-4 h-4 mr-1"}),"Add"]})]}),((bt=m.projects)==null?void 0:bt.length)>0?n.jsx("div",{className:"space-y-1 mb-2",children:m.projects.map(Z=>n.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-gray-50 dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[n.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:Z.replace(/^\/Users\/[^/]+/,"~")}),n.jsx(le,{type:"button",size:"sm",variant:"ghost",onClick:()=>h(Pe=>({...Pe,projects:Pe.projects.filter(Le=>Le!==Z)})),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:n.jsx(ei,{className:"w-4 h-4"})})]},Z))}):n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic mb-2",children:"No projects in this workstream."}),m.showPicker&&e.length>0&&n.jsx("div",{className:"border border-gray-200 dark:border-slate-700 rounded-lg p-2 max-h-48 overflow-y-auto bg-white dark:bg-slate-900",children:e.map(Z=>{var ft;const Pe=(ft=m.projects)==null?void 0:ft.includes(Z.path),Le=Ge(Z.path,m.id),st=$[Z.path],et=K[Z.path],jt=Y[Z.path]||[];return n.jsxs("div",{className:"mb-1",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",onClick:()=>Ve(Z.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:et?n.jsx(ut,{className:"w-4 h-4 animate-spin text-gray-400"}):st?n.jsx(Sr,{className:"w-4 h-4 text-gray-400"}):n.jsx(Kr,{className:"w-4 h-4 text-gray-400"})}),n.jsxs("button",{type:"button",onClick:()=>!Pe&&h(wt=>({...wt,projects:[...wt.projects||[],Z.path]})),disabled:Pe,className:`flex-1 text-left p-2 rounded transition-colors ${Pe?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Z.name}),n.jsxs("div",{className:"flex items-center gap-1",children:[Le&&n.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Le==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:Le}),Pe&&n.jsx(Kt,{className:"w-4 h-4 text-purple-600"})]})]}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:Z.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),st&&jt.length>0&&n.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:jt.map(wt=>{var jr;const Vt=(jr=m.projects)==null?void 0:jr.includes(wt.dir),rr=Ge(wt.dir,m.id);return n.jsxs("button",{type:"button",onClick:()=>!Vt&&h(hn=>({...hn,projects:[...hn.projects||[],wt.dir]})),disabled:Vt,className:`w-full text-left p-2 rounded transition-colors ${Vt?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:wt.name}),n.jsxs("div",{className:"flex items-center gap-1",children:[rr&&n.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${rr==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:rr}),Vt&&n.jsx(Kt,{className:"w-4 h-4 text-purple-600"})]})]}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:wt.relativePath})]},wt.dir)})}),st&&jt.length===0&&!et&&n.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},Z.id)})})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Rules"}),n.jsx(pt,{value:m.rules||"",onChange:Z=>h(Pe=>({...Pe,rules:Z.target.value})),placeholder:"Context rules for this workstream...",rows:8})]})]}),n.jsxs(It,{children:[n.jsx(le,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),n.jsxs(le,{onClick:Me,disabled:N,className:"bg-purple-600 hover:bg-purple-700",children:[N?n.jsx(ut,{className:"w-4 h-4 animate-spin mr-2"}):n.jsx(ui,{className:"w-4 h-4 mr-2"}),"Save Changes"]})]})]})}),n.jsx(Tt,{open:x,onOpenChange:Z=>{w(Z),Z||(W({}),b(new Set))},children:n.jsxs(St,{className:"max-w-lg",children:[n.jsx(Ct,{children:n.jsxs(kt,{className:"flex items-center gap-2",children:[n.jsx(Mi,{className:"w-5 h-5 text-purple-600"}),"Add Project to ",k==null?void 0:k.name]})}),n.jsxs("div",{className:"py-4",children:[n.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400 mb-4",children:"Select projects to add to this workstream (multi-select enabled):"}),e.length>0?n.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto border border-gray-200 dark:border-slate-700 rounded-lg p-2 bg-white dark:bg-slate-900",children:e.map(Z=>{var wt;const Pe=(wt=k==null?void 0:k.projects)==null?void 0:wt.includes(Z.path),Le=v.has(Z.path),st=Ge(Z.path,k==null?void 0:k.id),et=$[Z.path],jt=K[Z.path],ft=Y[Z.path]||[];return n.jsxs("div",{className:"mb-1",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",onClick:()=>Ve(Z.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:jt?n.jsx(ut,{className:"w-4 h-4 animate-spin text-gray-400"}):et?n.jsx(Sr,{className:"w-4 h-4 text-gray-400"}):n.jsx(Kr,{className:"w-4 h-4 text-gray-400"})}),n.jsxs("button",{type:"button",onClick:()=>!Pe&&ht(Z.path),disabled:Pe,className:`flex-1 text-left p-2 rounded transition-colors ${Pe?"bg-gray-100 dark:bg-slate-800 opacity-50 cursor-not-allowed":Le?"bg-purple-100 dark:bg-purple-950/50 ring-2 ring-purple-500":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:`w-4 h-4 rounded border-2 flex items-center justify-center ${Pe?"bg-gray-300 dark:bg-slate-600 border-gray-300 dark:border-slate-600":Le?"bg-purple-600 border-purple-600":"border-gray-300 dark:border-slate-600"}`,children:(Pe||Le)&&n.jsx(Kt,{className:"w-3 h-3 text-white"})}),n.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Z.name})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[st&&n.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${st==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:st}),Pe&&n.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:"added"})]})]}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate ml-6",children:Z.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),et&&ft.length>0&&n.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:ft.map(Vt=>{var tt;const rr=(tt=k==null?void 0:k.projects)==null?void 0:tt.includes(Vt.dir),jr=v.has(Vt.dir),hn=Ge(Vt.dir,k==null?void 0:k.id);return n.jsxs("button",{type:"button",onClick:()=>!rr&&ht(Vt.dir),disabled:rr,className:`w-full text-left p-2 rounded transition-colors ${rr?"bg-gray-100 dark:bg-slate-800 opacity-50 cursor-not-allowed":jr?"bg-purple-100 dark:bg-purple-950/50 ring-2 ring-purple-500":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:`w-4 h-4 rounded border-2 flex items-center justify-center ${rr?"bg-gray-300 dark:bg-slate-600 border-gray-300 dark:border-slate-600":jr?"bg-purple-600 border-purple-600":"border-gray-300 dark:border-slate-600"}`,children:(rr||jr)&&n.jsx(Kt,{className:"w-3 h-3 text-white"})}),n.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:Vt.name})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[hn&&n.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${hn==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:hn}),rr&&n.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:"added"})]})]}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate ml-6",children:Vt.relativePath})]},Vt.dir)})}),et&&ft.length===0&&!jt&&n.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},Z.id)})}):n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 text-center py-4",children:"No projects registered. Add projects in the Projects view first."})]}),n.jsxs(It,{children:[n.jsx(le,{variant:"outline",onClick:()=>{w(!1),b(new Set)},children:"Cancel"}),n.jsxs(le,{onClick:Rt,disabled:v.size===0||N,className:"bg-purple-600 hover:bg-purple-700",children:[N?n.jsx(ut,{className:"w-4 h-4 animate-spin mr-2"}):n.jsx(yt,{className:"w-4 h-4 mr-2"}),"Add Selected (",v.size,")"]})]})]})})]})}function TH(e,t=[]){let r=[];function s(u,d){const l=C.createContext(d);l.displayName=u+"Context";const c=r.length;r=[...r,d];const f=h=>{var b;const{scope:x,children:w,...k}=h,_=((b=x==null?void 0:x[e])==null?void 0:b[c])||l,v=C.useMemo(()=>k,Object.values(k));return n.jsx(_.Provider,{value:v,children:w})};f.displayName=u+"Provider";function m(h,x){var _;const w=((_=x==null?void 0:x[e])==null?void 0:_[c])||l,k=C.useContext(w);if(k)return k;if(d!==void 0)return d;throw new Error(`\`${h}\` must be used within \`${u}\``)}return[f,m]}const o=()=>{const u=r.map(d=>C.createContext(d));return function(l){const c=(l==null?void 0:l[e])||u;return C.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[s,RH(o,...t)]}function RH(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(u){const d=s.reduce((l,{useScope:c,scopeName:f})=>{const h=c(u)[`__scope${f}`];return{...l,...h}},{});return C.useMemo(()=>({[`__scope${t.scopeName}`]:d}),[d])}};return r.scopeName=t.scopeName,r}var MH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],O2=MH.reduce((e,t)=>{const r=Qu(`Primitive.${t}`),s=C.forwardRef((o,u)=>{const{asChild:d,...l}=o,c=d?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(c,{...l,ref:u})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),Xg="Progress",Jg=100,[DH]=TH(Xg),[LH,IH]=DH(Xg),B2=C.forwardRef((e,t)=>{const{__scopeProgress:r,value:s=null,max:o,getValueLabel:u=OH,...d}=e;(o||o===0)&&!Iw(o)&&console.error(BH(`${o}`,"Progress"));const l=Iw(o)?o:Jg;s!==null&&!Ow(s,l)&&console.error(FH(`${s}`,"Progress"));const c=Ow(s,l)?s:null,f=$u(c)?u(c,l):void 0;return n.jsx(LH,{scope:r,value:c,max:l,children:n.jsx(O2.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":$u(c)?c:void 0,"aria-valuetext":f,role:"progressbar","data-state":z2(c,l),"data-value":c??void 0,"data-max":l,...d,ref:t})})});B2.displayName=Xg;var F2="ProgressIndicator",$2=C.forwardRef((e,t)=>{const{__scopeProgress:r,...s}=e,o=IH(F2,r);return n.jsx(O2.div,{"data-state":z2(o.value,o.max),"data-value":o.value??void 0,"data-max":o.max,...s,ref:t})});$2.displayName=F2;function OH(e,t){return`${Math.round(e/t*100)}%`}function z2(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function $u(e){return typeof e=="number"}function Iw(e){return $u(e)&&!isNaN(e)&&e>0}function Ow(e,t){return $u(e)&&!isNaN(e)&&e<=t&&e>=0}function BH(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Jg}\`.`}function FH(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
|
|
2339
|
+
This cannot be undone.`))try{const Pe=await ke.deleteWorkstream(Z.id);Pe.success?(s(Le=>Le.filter(st=>st.id!==Z.id)),ee.success(`Deleted workstream: ${Z.name}`)):ee.error(Pe.error||"Failed to delete workstream")}catch(Pe){ee.error("Failed to delete workstream: "+Pe.message)}},Me=async()=>{if(m){R(!0);try{const Z=await ke.updateWorkstream(m.id,{name:m.name,rules:m.rules,projects:m.projects||[]});Z.success?(s(Pe=>Pe.map(Le=>Le.id===m.id?Z.workstream:Le)),ee.success("Workstream updated"),h(null)):ee.error(Z.error||"Failed to update workstream")}catch(Z){ee.error("Failed to update workstream: "+Z.message)}finally{R(!1)}}},ht=Z=>{b(Pe=>{const Le=new Set(Pe);return Le.has(Z)?Le.delete(Z):Le.add(Z),Le})},Rt=async()=>{if(!k||v.size===0)return;R(!0);let Z=0,Pe=null;for(const Le of v)try{const st=await ke.addProjectToWorkstream(k.id,Le);st.success&&(Pe=st.workstream,Z++)}catch(st){console.error("Failed to add project:",Le,st)}Pe&&s(Le=>Le.map(st=>st.id===k.id?Pe:st)),Z>0?ee.success(`Added ${Z} project${Z>1?"s":""} to ${k.name}`):ee.error("Failed to add projects"),R(!1),w(!1),_(null),b(new Set)},pe=async(Z,Pe)=>{try{const Le=await ke.removeProjectFromWorkstream(Z.id,Pe);Le.success?(s(st=>st.map(et=>et.id===Z.id?Le.workstream:et)),ee.success(`Removed project from ${Z.name}`)):ee.error(Le.error||"Failed to remove project")}catch(Le){ee.error("Failed to remove project: "+Le.message)}},be=Z=>Z.split("/").pop()||Z,Be=Z=>r.filter(Pe=>{var Le;return(Le=Pe.projects)==null?void 0:Le.includes(Z)}).length,Ge=(Z,Pe=null)=>{var et,jt;const Le=Be(Z),st=Pe?(jt=(et=r.find(ft=>ft.id===Pe))==null?void 0:et.projects)==null?void 0:jt.includes(Z):!1;return Le===0?null:Le===1?st?null:"in use":"shared"};return o?n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx(ut,{className:"w-8 h-8 animate-spin text-indigo-600"})}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-100 dark:bg-purple-900/30 flex items-center justify-center",children:n.jsx(Zs,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Workstreams"}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:"Context sets for multi-project workflows"})]})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(le,{variant:"outline",onClick:Ze,size:"sm",children:[n.jsx(pr,{className:"w-4 h-4 mr-2"}),"Refresh"]}),n.jsxs(le,{onClick:()=>f(!0),className:"bg-purple-600 hover:bg-purple-700",children:[n.jsx(yt,{className:"w-4 h-4 mr-2"}),"New Workstream"]})]})]}),n.jsxs("div",{className:"bg-purple-50 dark:bg-purple-950/30 border border-purple-200 dark:border-purple-800 rounded-lg p-4 text-sm text-purple-700 dark:text-purple-400",children:[n.jsx("p",{className:"font-medium mb-1",children:"What are Workstreams?"}),n.jsx("p",{children:"Workstreams are virtual projects that group repos belonging to the same product. When active, workstream rules are automatically injected into every Claude session."})]}),n.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm overflow-hidden",children:r.length===0?n.jsxs("div",{className:"p-12 text-center",children:[n.jsx(Zs,{className:"w-12 h-12 mx-auto mb-4 text-gray-300 dark:text-slate-600"}),n.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"No Workstreams Yet"}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 mb-4",children:"Create your first workstream to organize multi-project contexts."}),n.jsxs(le,{onClick:()=>f(!0),children:[n.jsx(yt,{className:"w-4 h-4 mr-2"}),"Create Your First Workstream"]})]}):n.jsx("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:r.map(Z=>{var Pe,Le,st;return n.jsxs("div",{className:"group",children:[n.jsxs("div",{className:"p-4 flex items-center gap-4 transition-colors cursor-pointer hover:bg-gray-50 dark:hover:bg-slate-900",onClick:()=>l(d===Z.id?null:Z.id),children:[n.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-400",children:d===Z.id?n.jsx(Sr,{className:"w-4 h-4"}):n.jsx(Kr,{className:"w-4 h-4"})}),n.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center bg-gray-100 dark:bg-slate-800",children:n.jsx(Zs,{className:"w-5 h-5 text-gray-500 dark:text-slate-400"})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h3",{className:"font-medium truncate text-gray-900 dark:text-white",children:Z.name}),((Pe=Z.projects)==null?void 0:Pe.length)>0&&n.jsxs("span",{className:"text-xs bg-gray-100 dark:bg-slate-800 text-gray-600 dark:text-slate-400 px-1.5 py-0.5 rounded",children:[Z.projects.length," project",Z.projects.length!==1?"s":""]}),Z.rules&&n.jsxs("span",{className:"text-xs bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 px-1.5 py-0.5 rounded",children:[n.jsx(Cr,{className:"w-3 h-3 inline mr-0.5"}),"Rules"]})]}),n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 truncate",children:((Le=Z.projects)==null?void 0:Le.length)>0?Z.projects.map(et=>be(et)).join(", "):"No projects added"})]}),n.jsxs("div",{className:"flex items-center gap-2",onClick:et=>et.stopPropagation(),children:[n.jsx(le,{size:"sm",variant:"ghost",onClick:()=>h({...Z}),className:"text-gray-500 dark:text-slate-400 hover:text-purple-600 dark:hover:text-purple-400",title:"Edit workstream",children:n.jsx(nb,{className:"w-4 h-4"})}),n.jsx(le,{size:"sm",variant:"ghost",onClick:()=>ge(Z),className:"text-gray-500 dark:text-slate-400 hover:text-red-600 dark:hover:text-red-400",title:"Delete workstream",children:n.jsx(jn,{className:"w-4 h-4"})})]})]}),d===Z.id&&n.jsxs("div",{className:"px-4 pb-4 pl-16 space-y-4 bg-gray-50/50 dark:bg-slate-900/50",children:[n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),n.jsxs(le,{size:"sm",variant:"outline",onClick:()=>{_(Z),w(!0)},children:[n.jsx(Mi,{className:"w-4 h-4 mr-1"}),"Add Project"]})]}),((st=Z.projects)==null?void 0:st.length)>0?n.jsx("div",{className:"space-y-1",children:Z.projects.map(et=>n.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[n.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:et.replace(/^\/Users\/[^/]+/,"~")}),n.jsx(le,{size:"sm",variant:"ghost",onClick:()=>pe(Z,et),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:n.jsx($M,{className:"w-4 h-4"})})]},et))}):n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic",children:"No projects added yet. Add projects to help organize your workstream."})]}),n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:"Rules"}),Z.rules?n.jsx("pre",{className:"text-sm text-gray-600 dark:text-slate-400 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700 p-3 overflow-auto max-h-40 whitespace-pre-wrap",children:Z.rules}):n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic",children:"No rules defined. Click Edit to add context rules for this workstream."})]})]})]},Z.id)})})}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Hook Integration"}),n.jsx(zo,{children:n.jsxs(on,{children:[n.jsx(an,{asChild:!0,children:n.jsx("button",{className:"text-gray-400 hover:text-gray-600 dark:hover:text-slate-300",children:n.jsx(Ku,{className:"w-4 h-4"})})}),n.jsx(qr,{side:"right",className:"max-w-xs",children:n.jsxs("p",{className:"text-sm",children:[n.jsx("strong",{children:"What are hooks?"}),n.jsx("br",{}),n.jsx("br",{}),"Hooks are scripts that run automatically at specific points in Claude Code sessions. The workstream hook runs before each prompt and injects your active workstream's rules into the context.",n.jsx("br",{}),n.jsx("br",{}),n.jsx("strong",{children:"How it works:"}),n.jsx("br",{}),"1. You activate a workstream",n.jsx("br",{}),"2. Hook detects the active workstream",n.jsx("br",{}),"3. Rules are prepended to Claude's context",n.jsx("br",{}),"4. Claude understands your project context"]})})]})})]}),U.isInstalled?n.jsx("div",{className:"bg-green-50 dark:bg-green-950/30 border border-green-200 dark:border-green-800 rounded-lg p-4 text-sm text-green-700 dark:text-green-400",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Em,{className:"w-5 h-5 flex-shrink-0"}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium",children:"Hook Installed"}),n.jsx("p",{className:"text-green-600 dark:text-green-500",children:"Workstream rules will be automatically injected into every Claude session."})]})]})}):n.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg p-4 text-sm text-amber-700 dark:text-amber-400",children:n.jsxs("div",{className:"flex gap-3",children:[n.jsx(Oi,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"font-medium mb-1",children:"Hook Not Installed"}),n.jsx("p",{className:"mb-3",children:"Install the pre-prompt hook to automatically inject workstream rules into every Claude session."}),n.jsxs(le,{onClick:Re,disabled:M||U.loading,size:"sm",className:"bg-amber-600 hover:bg-amber-700 text-white",children:[M?n.jsx(ut,{className:"w-4 h-4 animate-spin mr-2"}):n.jsx(bl,{className:"w-4 h-4 mr-2"}),"Install Hook"]}),n.jsxs("p",{className:"text-xs mt-2 text-amber-600 dark:text-amber-500",children:["Creates ",n.jsx("code",{className:"bg-amber-100 dark:bg-amber-900/50 px-1 rounded",children:"~/.claude/hooks/pre-prompt.sh"})]})]})]})})]}),q&&q.totalSessions>0&&n.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm p-4",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(X4,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"}),n.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Activity Insights"})]}),n.jsxs(le,{variant:"ghost",size:"sm",onClick:De,className:"text-gray-500 dark:text-slate-400 hover:text-red-500",children:[n.jsx(jn,{className:"w-4 h-4 mr-1"}),"Clear Old"]})]}),n.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-4",children:[n.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[n.jsx(b1,{className:"w-3 h-3"}),"Sessions"]}),n.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:q.totalSessions})]}),n.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[n.jsx(Cr,{className:"w-3 h-3"}),"Files Tracked"]}),n.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:q.totalFiles})]}),n.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[n.jsx(Zs,{className:"w-3 h-3"}),"Projects Active"]}),n.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:q.projectCount})]})]}),((Ke=q.topProjects)==null?void 0:Ke.length)>0&&n.jsxs("div",{children:[n.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:"Most Active Projects"}),n.jsx("div",{className:"space-y-1",children:q.topProjects.slice(0,5).map((Z,Pe)=>n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsx("span",{className:"text-gray-600 dark:text-slate-400 truncate",title:Z.path,children:Z.path.split("/").pop()}),n.jsxs("span",{className:"text-gray-400 dark:text-slate-500 text-xs",children:[Z.fileCount," files"]})]},Z.path))})]})]}),de.length>0&&n.jsxs("div",{className:"bg-gradient-to-r from-indigo-50 to-purple-50 dark:from-indigo-950/30 dark:to-purple-950/30 rounded-xl border border-indigo-200 dark:border-indigo-800 p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsx(Ht,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"}),n.jsx("h3",{className:"font-medium text-indigo-900 dark:text-indigo-300",children:"Suggested Workstreams"}),n.jsx("span",{className:"text-xs bg-indigo-100 dark:bg-indigo-900/50 text-indigo-600 dark:text-indigo-400 px-1.5 py-0.5 rounded",children:"Based on activity patterns"})]}),n.jsx("p",{className:"text-sm text-indigo-700 dark:text-indigo-400 mb-4",children:"These projects are frequently worked on together. Create a workstream to group them?"}),n.jsx("div",{className:"space-y-3",children:de.map(Z=>n.jsxs("div",{className:"bg-white dark:bg-slate-900 rounded-lg border border-indigo-200 dark:border-indigo-800 p-3",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ju,{className:"w-4 h-4 text-amber-500"}),n.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Z.name}),Z.coActivityScore&&n.jsxs("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:[Z.coActivityScore,"% co-activity"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(le,{size:"sm",variant:"ghost",onClick:()=>re(Z),className:"text-gray-400 hover:text-gray-600 dark:hover:text-slate-300",title:"Dismiss suggestion",children:n.jsx(ei,{className:"w-4 h-4"})}),n.jsxs(le,{size:"sm",onClick:()=>ie(Z),className:"bg-indigo-600 hover:bg-indigo-700",children:[n.jsx(yt,{className:"w-4 h-4 mr-1"}),"Create"]})]})]}),n.jsx("div",{className:"flex flex-wrap gap-1",children:Z.projects.map(Pe=>n.jsx("span",{className:"text-xs bg-gray-100 dark:bg-slate-800 text-gray-600 dark:text-slate-400 px-2 py-0.5 rounded",children:Pe.split("/").pop()},Pe))})]},Z.name))})]}),n.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[n.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),n.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[n.jsx("p",{children:"coder-config workstream # List workstreams"}),n.jsx("p",{children:'coder-config workstream use "Name" # Set workstream for this tab'}),n.jsx("p",{children:'coder-config workstream create "Name" # Create workstream'})]})]}),n.jsx(Tt,{open:c,onOpenChange:Z=>{Z||(f(!1),y(""),E(""),T([]),O(!1),W({}))},children:n.jsxs(St,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[n.jsx(Ct,{children:n.jsxs(kt,{className:"flex items-center gap-2",children:[n.jsx(Zs,{className:"w-5 h-5 text-purple-600"}),"Create Workstream"]})}),n.jsxs("div",{className:"space-y-4 py-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Name"}),n.jsx(ct,{value:g,onChange:Z=>y(Z.target.value),placeholder:"e.g., User Auth, Admin Dashboard",autoFocus:!0})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),n.jsxs(le,{type:"button",size:"sm",variant:"outline",onClick:()=>O(!I),children:[n.jsx(Mi,{className:"w-4 h-4 mr-1"}),"Add"]})]}),P.length>0?n.jsx("div",{className:"space-y-1 mb-2",children:P.map(Z=>n.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-gray-50 dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[n.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:Z.replace(/^\/Users\/[^/]+/,"~")}),n.jsx(le,{type:"button",size:"sm",variant:"ghost",onClick:()=>ye(Z),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:n.jsx(ei,{className:"w-4 h-4"})})]},Z))}):n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic mb-2",children:"No projects added. Add projects to help organize your workstream."}),I&&e.length>0&&n.jsx("div",{className:"border border-gray-200 dark:border-slate-700 rounded-lg p-2 max-h-64 overflow-y-auto bg-white dark:bg-slate-900",children:e.map(Z=>{const Pe=Ge(Z.path),Le=$[Z.path],st=K[Z.path],et=Y[Z.path]||[],jt=P.includes(Z.path);return n.jsxs("div",{className:"mb-1",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",onClick:()=>Ve(Z.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:st?n.jsx(ut,{className:"w-4 h-4 animate-spin text-gray-400"}):Le?n.jsx(Sr,{className:"w-4 h-4 text-gray-400"}):n.jsx(Kr,{className:"w-4 h-4 text-gray-400"})}),n.jsxs("button",{type:"button",onClick:()=>Oe(Z.path),disabled:jt,className:`flex-1 text-left p-2 rounded transition-colors ${jt?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Z.name}),n.jsxs("div",{className:"flex items-center gap-1",children:[Pe&&n.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Pe==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:Pe}),jt&&n.jsx(Kt,{className:"w-4 h-4 text-purple-600"})]})]}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:Z.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),Le&&et.length>0&&n.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:et.map(ft=>{const wt=P.includes(ft.dir),Vt=Ge(ft.dir);return n.jsxs("button",{type:"button",onClick:()=>Oe(ft.dir),disabled:wt,className:`w-full text-left p-2 rounded transition-colors ${wt?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:ft.name}),n.jsxs("div",{className:"flex items-center gap-1",children:[Vt&&n.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Vt==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:Vt}),wt&&n.jsx(Kt,{className:"w-4 h-4 text-purple-600"})]})]}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono",children:ft.relativePath})]},ft.dir)})}),Le&&et.length===0&&!st&&n.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},Z.id)})})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Context (optional)"}),n.jsx(pt,{value:j,onChange:Z=>E(Z.target.value),placeholder:"Context rules for this workstream. These will be injected into every Claude session when this workstream is active.",rows:6}),n.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:'Example: "Focus on user authentication. Use JWT tokens. React Query for state management."'})]})]}),n.jsxs(It,{children:[n.jsx(le,{variant:"outline",onClick:()=>{f(!1),y(""),E(""),T([]),O(!1),W({})},children:"Cancel"}),n.jsxs(le,{onClick:Se,disabled:N||!g.trim(),className:"bg-purple-600 hover:bg-purple-700",children:[N?n.jsx(ut,{className:"w-4 h-4 animate-spin mr-2"}):n.jsx(yt,{className:"w-4 h-4 mr-2"}),"Create"]})]})]})}),n.jsx(Tt,{open:!!m,onOpenChange:Z=>!Z&&h(null),children:n.jsxs(St,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[n.jsx(Ct,{children:n.jsxs(kt,{className:"flex items-center gap-2",children:[n.jsx(nb,{className:"w-5 h-5 text-purple-600"}),"Edit Workstream"]})}),m&&n.jsxs("div",{className:"space-y-4 py-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Name"}),n.jsx(ct,{value:m.name,onChange:Z=>h(Pe=>({...Pe,name:Z.target.value}))})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),n.jsxs(le,{type:"button",size:"sm",variant:"outline",onClick:()=>h(Z=>({...Z,showPicker:!Z.showPicker})),children:[n.jsx(Mi,{className:"w-4 h-4 mr-1"}),"Add"]})]}),((bt=m.projects)==null?void 0:bt.length)>0?n.jsx("div",{className:"space-y-1 mb-2",children:m.projects.map(Z=>n.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-gray-50 dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[n.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:Z.replace(/^\/Users\/[^/]+/,"~")}),n.jsx(le,{type:"button",size:"sm",variant:"ghost",onClick:()=>h(Pe=>({...Pe,projects:Pe.projects.filter(Le=>Le!==Z)})),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:n.jsx(ei,{className:"w-4 h-4"})})]},Z))}):n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic mb-2",children:"No projects in this workstream."}),m.showPicker&&e.length>0&&n.jsx("div",{className:"border border-gray-200 dark:border-slate-700 rounded-lg p-2 max-h-48 overflow-y-auto bg-white dark:bg-slate-900",children:e.map(Z=>{var ft;const Pe=(ft=m.projects)==null?void 0:ft.includes(Z.path),Le=Ge(Z.path,m.id),st=$[Z.path],et=K[Z.path],jt=Y[Z.path]||[];return n.jsxs("div",{className:"mb-1",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",onClick:()=>Ve(Z.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:et?n.jsx(ut,{className:"w-4 h-4 animate-spin text-gray-400"}):st?n.jsx(Sr,{className:"w-4 h-4 text-gray-400"}):n.jsx(Kr,{className:"w-4 h-4 text-gray-400"})}),n.jsxs("button",{type:"button",onClick:()=>!Pe&&h(wt=>({...wt,projects:[...wt.projects||[],Z.path]})),disabled:Pe,className:`flex-1 text-left p-2 rounded transition-colors ${Pe?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Z.name}),n.jsxs("div",{className:"flex items-center gap-1",children:[Le&&n.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Le==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:Le}),Pe&&n.jsx(Kt,{className:"w-4 h-4 text-purple-600"})]})]}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:Z.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),st&&jt.length>0&&n.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:jt.map(wt=>{var jr;const Vt=(jr=m.projects)==null?void 0:jr.includes(wt.dir),rr=Ge(wt.dir,m.id);return n.jsxs("button",{type:"button",onClick:()=>!Vt&&h(hn=>({...hn,projects:[...hn.projects||[],wt.dir]})),disabled:Vt,className:`w-full text-left p-2 rounded transition-colors ${Vt?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:wt.name}),n.jsxs("div",{className:"flex items-center gap-1",children:[rr&&n.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${rr==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:rr}),Vt&&n.jsx(Kt,{className:"w-4 h-4 text-purple-600"})]})]}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:wt.relativePath})]},wt.dir)})}),st&&jt.length===0&&!et&&n.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},Z.id)})})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Rules"}),n.jsx(pt,{value:m.rules||"",onChange:Z=>h(Pe=>({...Pe,rules:Z.target.value})),placeholder:"Context rules for this workstream...",rows:8})]})]}),n.jsxs(It,{children:[n.jsx(le,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),n.jsxs(le,{onClick:Me,disabled:N,className:"bg-purple-600 hover:bg-purple-700",children:[N?n.jsx(ut,{className:"w-4 h-4 animate-spin mr-2"}):n.jsx(ui,{className:"w-4 h-4 mr-2"}),"Save Changes"]})]})]})}),n.jsx(Tt,{open:x,onOpenChange:Z=>{w(Z),Z||(W({}),b(new Set))},children:n.jsxs(St,{className:"max-w-lg",children:[n.jsx(Ct,{children:n.jsxs(kt,{className:"flex items-center gap-2",children:[n.jsx(Mi,{className:"w-5 h-5 text-purple-600"}),"Add Project to ",k==null?void 0:k.name]})}),n.jsxs("div",{className:"py-4",children:[n.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400 mb-4",children:"Select projects to add to this workstream (multi-select enabled):"}),e.length>0?n.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto border border-gray-200 dark:border-slate-700 rounded-lg p-2 bg-white dark:bg-slate-900",children:e.map(Z=>{var wt;const Pe=(wt=k==null?void 0:k.projects)==null?void 0:wt.includes(Z.path),Le=v.has(Z.path),st=Ge(Z.path,k==null?void 0:k.id),et=$[Z.path],jt=K[Z.path],ft=Y[Z.path]||[];return n.jsxs("div",{className:"mb-1",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",onClick:()=>Ve(Z.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:jt?n.jsx(ut,{className:"w-4 h-4 animate-spin text-gray-400"}):et?n.jsx(Sr,{className:"w-4 h-4 text-gray-400"}):n.jsx(Kr,{className:"w-4 h-4 text-gray-400"})}),n.jsxs("button",{type:"button",onClick:()=>!Pe&&ht(Z.path),disabled:Pe,className:`flex-1 text-left p-2 rounded transition-colors ${Pe?"bg-gray-100 dark:bg-slate-800 opacity-50 cursor-not-allowed":Le?"bg-purple-100 dark:bg-purple-950/50 ring-2 ring-purple-500":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:`w-4 h-4 rounded border-2 flex items-center justify-center ${Pe?"bg-gray-300 dark:bg-slate-600 border-gray-300 dark:border-slate-600":Le?"bg-purple-600 border-purple-600":"border-gray-300 dark:border-slate-600"}`,children:(Pe||Le)&&n.jsx(Kt,{className:"w-3 h-3 text-white"})}),n.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Z.name})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[st&&n.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${st==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:st}),Pe&&n.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:"added"})]})]}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate ml-6",children:Z.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),et&&ft.length>0&&n.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:ft.map(Vt=>{var tt;const rr=(tt=k==null?void 0:k.projects)==null?void 0:tt.includes(Vt.dir),jr=v.has(Vt.dir),hn=Ge(Vt.dir,k==null?void 0:k.id);return n.jsxs("button",{type:"button",onClick:()=>!rr&&ht(Vt.dir),disabled:rr,className:`w-full text-left p-2 rounded transition-colors ${rr?"bg-gray-100 dark:bg-slate-800 opacity-50 cursor-not-allowed":jr?"bg-purple-100 dark:bg-purple-950/50 ring-2 ring-purple-500":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:`w-4 h-4 rounded border-2 flex items-center justify-center ${rr?"bg-gray-300 dark:bg-slate-600 border-gray-300 dark:border-slate-600":jr?"bg-purple-600 border-purple-600":"border-gray-300 dark:border-slate-600"}`,children:(rr||jr)&&n.jsx(Kt,{className:"w-3 h-3 text-white"})}),n.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:Vt.name})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[hn&&n.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${hn==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:hn}),rr&&n.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:"added"})]})]}),n.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate ml-6",children:Vt.relativePath})]},Vt.dir)})}),et&&ft.length===0&&!jt&&n.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},Z.id)})}):n.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 text-center py-4",children:"No projects registered. Add projects in the Projects view first."})]}),n.jsxs(It,{children:[n.jsx(le,{variant:"outline",onClick:()=>{w(!1),b(new Set)},children:"Cancel"}),n.jsxs(le,{onClick:Rt,disabled:v.size===0||N,className:"bg-purple-600 hover:bg-purple-700",children:[N?n.jsx(ut,{className:"w-4 h-4 animate-spin mr-2"}):n.jsx(yt,{className:"w-4 h-4 mr-2"}),"Add Selected (",v.size,")"]})]})]})})]})}function TH(e,t=[]){let r=[];function s(u,d){const l=C.createContext(d);l.displayName=u+"Context";const c=r.length;r=[...r,d];const f=h=>{var b;const{scope:x,children:w,...k}=h,_=((b=x==null?void 0:x[e])==null?void 0:b[c])||l,v=C.useMemo(()=>k,Object.values(k));return n.jsx(_.Provider,{value:v,children:w})};f.displayName=u+"Provider";function m(h,x){var _;const w=((_=x==null?void 0:x[e])==null?void 0:_[c])||l,k=C.useContext(w);if(k)return k;if(d!==void 0)return d;throw new Error(`\`${h}\` must be used within \`${u}\``)}return[f,m]}const o=()=>{const u=r.map(d=>C.createContext(d));return function(l){const c=(l==null?void 0:l[e])||u;return C.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[s,RH(o,...t)]}function RH(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(u){const d=s.reduce((l,{useScope:c,scopeName:f})=>{const h=c(u)[`__scope${f}`];return{...l,...h}},{});return C.useMemo(()=>({[`__scope${t.scopeName}`]:d}),[d])}};return r.scopeName=t.scopeName,r}var MH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],O2=MH.reduce((e,t)=>{const r=Qu(`Primitive.${t}`),s=C.forwardRef((o,u)=>{const{asChild:d,...l}=o,c=d?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(c,{...l,ref:u})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),Xg="Progress",Jg=100,[DH]=TH(Xg),[LH,IH]=DH(Xg),B2=C.forwardRef((e,t)=>{const{__scopeProgress:r,value:s=null,max:o,getValueLabel:u=OH,...d}=e;(o||o===0)&&!Iw(o)&&console.error(BH(`${o}`,"Progress"));const l=Iw(o)?o:Jg;s!==null&&!Ow(s,l)&&console.error(FH(`${s}`,"Progress"));const c=Ow(s,l)?s:null,f=$u(c)?u(c,l):void 0;return n.jsx(LH,{scope:r,value:c,max:l,children:n.jsx(O2.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":$u(c)?c:void 0,"aria-valuetext":f,role:"progressbar","data-state":z2(c,l),"data-value":c??void 0,"data-max":l,...d,ref:t})})});B2.displayName=Xg;var F2="ProgressIndicator",$2=C.forwardRef((e,t)=>{const{__scopeProgress:r,...s}=e,o=IH(F2,r);return n.jsx(O2.div,{"data-state":z2(o.value,o.max),"data-value":o.value??void 0,"data-max":o.max,...s,ref:t})});$2.displayName=F2;function OH(e,t){return`${Math.round(e/t*100)}%`}function z2(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function $u(e){return typeof e=="number"}function Iw(e){return $u(e)&&!isNaN(e)&&e>0}function Ow(e,t){return $u(e)&&!isNaN(e)&&e<=t&&e>=0}function BH(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Jg}\`.`}function FH(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
|
|
2340
2340
|
- a positive number
|
|
2341
2341
|
- less than the value passed to \`max\` (or ${Jg} if no \`max\` prop is set)
|
|
2342
2342
|
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
@@ -2346,9 +2346,9 @@ Think of Coder Config as your **control center** for Claude Code (and other AI c
|
|
|
2346
2346
|
|
|
2347
2347
|
### How are you using Coder Config?
|
|
2348
2348
|
|
|
2349
|
-
**Desktop App** - Downloaded from [GitHub Releases](https://github.com/regression-io/
|
|
2349
|
+
**Desktop App** - Downloaded from [GitHub Releases](https://github.com/regression-io/coder-config/releases). No terminal needed!
|
|
2350
2350
|
|
|
2351
|
-
**npm Package** - Installed via \`npm install -g
|
|
2351
|
+
**npm Package** - Installed via \`npm install -g coder-config\` and running \`coder-config ui\`.
|
|
2352
2352
|
|
|
2353
2353
|
Both work identically - this tutorial applies to either.
|
|
2354
2354
|
|
|
@@ -3188,10 +3188,10 @@ Click **"Create MCP"** to build your own MCP server. Great for connecting Claude
|
|
|
3188
3188
|
|
|
3189
3189
|
**For CLI Users**
|
|
3190
3190
|
\`\`\`bash
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3191
|
+
coder-config ui # Start the UI
|
|
3192
|
+
coder-config ui stop # Stop the daemon
|
|
3193
|
+
coder-config apply # Apply config to current project
|
|
3194
|
+
coder-config --help # See all commands
|
|
3195
3195
|
\`\`\`
|
|
3196
3196
|
|
|
3197
3197
|
*Desktop app users: These commands are optional - the app handles everything automatically.*
|
package/ui/dist/index.html
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
<!-- PWA Manifest -->
|
|
21
21
|
<link rel="manifest" href="/manifest.json">
|
|
22
|
-
<script type="module" crossorigin src="/assets/index-
|
|
22
|
+
<script type="module" crossorigin src="/assets/index-D9QGvYNF.js"></script>
|
|
23
23
|
<link rel="stylesheet" crossorigin href="/assets/index-DjLdm3Mr.css">
|
|
24
24
|
</head>
|
|
25
25
|
<body>
|