@lssm/bundle.contractspec-workspace 0.0.0-canary-20251213172311 → 0.0.0-canary-20251215231151

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.
Files changed (54) hide show
  1. package/dist/_virtual/rolldown_runtime.js +1 -0
  2. package/dist/ai/agents/claude-code-agent.js +44 -0
  3. package/dist/ai/agents/cursor-agent.js +168 -0
  4. package/dist/ai/agents/index.js +1 -0
  5. package/dist/ai/agents/openai-codex-agent.js +34 -0
  6. package/dist/ai/agents/orchestrator.js +1 -0
  7. package/dist/ai/agents/simple-agent.js +15 -0
  8. package/dist/ai/client.js +1 -0
  9. package/dist/ai/index.js +1 -0
  10. package/dist/ai/prompts/code-generation.js +100 -0
  11. package/dist/ai/prompts/index.js +1 -0
  12. package/dist/ai/prompts/spec-creation.js +69 -0
  13. package/dist/ai/providers.js +1 -0
  14. package/dist/index.js +1 -1
  15. package/dist/node_modules/chalk/source/index.js +2 -0
  16. package/dist/node_modules/chalk/source/utilities.js +4 -0
  17. package/dist/node_modules/chalk/source/vendor/ansi-styles/index.js +1 -0
  18. package/dist/node_modules/chalk/source/vendor/supports-color/browser.js +1 -0
  19. package/dist/node_modules/cli-cursor/index.js +1 -0
  20. package/dist/node_modules/cli-spinners/index.js +1 -0
  21. package/dist/node_modules/cli-spinners/spinners.js +1 -0
  22. package/dist/node_modules/get-east-asian-width/index.js +1 -0
  23. package/dist/node_modules/get-east-asian-width/lookup.js +1 -0
  24. package/dist/node_modules/is-interactive/index.js +1 -0
  25. package/dist/node_modules/is-unicode-supported/index.js +1 -0
  26. package/dist/node_modules/log-symbols/browser-symbols.js +1 -0
  27. package/dist/node_modules/mimic-function/index.js +1 -0
  28. package/dist/node_modules/onetime/index.js +1 -0
  29. package/dist/node_modules/ora/index.js +6 -0
  30. package/dist/node_modules/restore-cursor/index.js +1 -0
  31. package/dist/node_modules/signal-exit/dist/mjs/index.js +1 -0
  32. package/dist/node_modules/signal-exit/dist/mjs/signals.js +1 -0
  33. package/dist/node_modules/stdin-discarder/index.js +1 -0
  34. package/dist/node_modules/string-width/index.js +1 -0
  35. package/dist/node_modules/strip-ansi/index.js +1 -0
  36. package/dist/node_modules/strip-ansi/node_modules/ansi-regex/index.js +1 -0
  37. package/dist/services/index.js +1 -1
  38. package/dist/services/openapi.js +2 -0
  39. package/dist/services/registry.js +1 -0
  40. package/dist/templates/app-config.template.js +33 -0
  41. package/dist/templates/data-view.template.js +54 -0
  42. package/dist/templates/event.template.js +24 -0
  43. package/dist/templates/experiment.template.js +62 -0
  44. package/dist/templates/handler.template.js +63 -0
  45. package/dist/templates/index.js +1 -0
  46. package/dist/templates/integration.template.js +75 -0
  47. package/dist/templates/knowledge.template.js +33 -0
  48. package/dist/templates/migration.template.js +37 -0
  49. package/dist/templates/operation.template.js +88 -0
  50. package/dist/templates/presentation.template.js +53 -0
  51. package/dist/templates/telemetry.template.js +69 -0
  52. package/dist/templates/workflow-runner.template.js +43 -0
  53. package/dist/templates/workflow.template.js +41 -0
  54. package/package.json +3 -3
@@ -0,0 +1,6 @@
1
+ import e from"../chalk/source/index.js";import t from"../cli-cursor/index.js";import n from"../cli-spinners/index.js";import{error as r,info as i,success as a,warning as o}from"../log-symbols/browser-symbols.js";import s from"../strip-ansi/index.js";import c from"../string-width/index.js";import l from"../is-interactive/index.js";import u from"../is-unicode-supported/index.js";import d from"../stdin-discarder/index.js";import f from"node:process";var p=class{#e=0;#t=!1;#n=0;#r=-1;#i=0;#a=0;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;#g;color;constructor(e){typeof e==`string`&&(e={text:e}),this.#o={color:`cyan`,stream:f.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#o.color,this.spinner=this.#o.spinner,this.#u=this.#o.interval,this.#c=this.#o.stream,this.#d=typeof this.#o.isEnabled==`boolean`?this.#o.isEnabled:l({stream:this.#c}),this.#f=typeof this.#o.isSilent==`boolean`?this.#o.isSilent:!1,this.text=this.#o.text,this.prefixText=this.#o.prefixText,this.suffixText=this.#o.suffixText,this.indent=this.#o.indent,f.env.NODE_ENV===`test`&&(this._stream=this.#c,this._isEnabled=this.#d,Object.defineProperty(this,`_linesToClear`,{get(){return this.#e},set(e){this.#e=e}}),Object.defineProperty(this,`_frameIndex`,{get(){return this.#r}}),Object.defineProperty(this,`_lineCount`,{get(){return this.#n}}))}get indent(){return this.#p}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw Error("The `indent` option must be an integer from 0 and up");this.#p=e,this.#x()}get interval(){return this.#u??this.#s.interval??100}get spinner(){return this.#s}set spinner(e){if(this.#r=-1,this.#u=void 0,typeof e==`object`){if(!Array.isArray(e.frames)||e.frames.length===0||e.frames.some(e=>typeof e!=`string`))throw Error("The given spinner must have a non-empty `frames` array of strings");if(e.interval!==void 0&&!(Number.isInteger(e.interval)&&e.interval>0))throw Error("`spinner.interval` must be a positive integer if provided");this.#s=e}else if(!u())this.#s=n.line;else if(e===void 0)this.#s=n.dots;else if(e!==`default`&&n[e])this.#s=n[e];else throw Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#m}set text(e=``){this.#m=e,this.#x()}get prefixText(){return this.#h}set prefixText(e=``){this.#h=e,this.#x()}get suffixText(){return this.#g}set suffixText(e=``){this.#g=e,this.#x()}get isSpinning(){return this.#l!==void 0}#_(e,t,n=!1){let r=typeof e==`function`?e():e;return typeof r==`string`&&r!==``?n?t+r:r+t:``}#v(e=this.#h,t=` `){return this.#_(e,t,!1)}#y(e=this.#g,t=` `){return this.#_(e,t,!0)}#b(e,t){let n=0;for(let r of s(e).split(`
2
+ `))n+=Math.max(1,Math.ceil(c(r)/t));return n}#x(){let e=this.#c.columns??80,t=typeof this.#h==`function`?``:this.#h,n=typeof this.#g==`function`?``:this.#g,r=typeof t==`string`&&t!==``?t+` `:``,i=typeof n==`string`&&n!==``?` `+n:``,a=` `.repeat(this.#p)+r+`-`+(typeof this.#m==`string`?` `+this.#m:``)+i;this.#n=this.#b(a,e)}get isEnabled(){return this.#d&&!this.#f}set isEnabled(e){if(typeof e!=`boolean`)throw TypeError("The `isEnabled` option must be a boolean");this.#d=e}get isSilent(){return this.#f}set isSilent(e){if(typeof e!=`boolean`)throw TypeError("The `isSilent` option must be a boolean");this.#f=e}frame(){let t=Date.now();(this.#r===-1||t-this.#i>=this.interval)&&(this.#r=++this.#r%this.#s.frames.length,this.#i=t);let{frames:n}=this.#s,r=n[this.#r];this.color&&(r=e[this.color](r));let i=this.#v(this.#h,` `),a=typeof this.text==`string`?` `+this.text:``,o=this.#y(this.#g,` `);return i+r+a+o}clear(){if(!this.#d||!this.#c.isTTY)return this;this.#c.cursorTo(0);for(let e=0;e<this.#e;e++)e>0&&this.#c.moveCursor(0,-1),this.#c.clearLine(1);return(this.#p||this.#a!==this.#p)&&this.#c.cursorTo(this.#p),this.#a=this.#p,this.#e=0,this}render(){if(!this.#d||this.#f)return this;this.clear();let e=this.frame(),t=this.#c.columns??80,n=this.#b(e,t),r=this.#c.rows;if(r&&r>1&&n>r){let t=e.split(`
3
+ `),n=r-1;e=[...t.slice(0,n),`... (content truncated to fit terminal)`].join(`
4
+ `)}return this.#c.write(e),this.#e=this.#b(e,t),this}start(e){if(e&&(this.text=e),this.#f)return this;if(!this.#d){let e=` `.repeat(this.#p)+this.#v(this.#h,` `)+(this.text?`- ${this.text}`:``)+this.#y(this.#g,` `);return e.trim()!==``&&this.#c.write(e+`
5
+ `),this}return this.isSpinning?this:(this.#o.hideCursor&&t.hide(this.#c),this.#o.discardStdin&&f.stdin.isTTY&&(this.#t=!0,d.start()),this.render(),this.#l=setInterval(this.render.bind(this),this.interval),this)}stop(){return clearInterval(this.#l),this.#l=void 0,this.#r=0,this.#d&&(this.clear(),this.#o.hideCursor&&t.show(this.#c)),this.#o.discardStdin&&f.stdin.isTTY&&this.#t&&(d.stop(),this.#t=!1),this}succeed(e){return this.stopAndPersist({symbol:a,text:e})}fail(e){return this.stopAndPersist({symbol:r,text:e})}warn(e){return this.stopAndPersist({symbol:o,text:e})}info(e){return this.stopAndPersist({symbol:i,text:e})}stopAndPersist(e={}){if(this.#f)return this;let t=e.prefixText??this.#h,n=this.#v(t,` `),r=e.symbol??` `,i=e.text??this.text,a=typeof i==`string`?(r?` `:``)+i:``,o=e.suffixText??this.#g,s=this.#y(o,` `),c=n+r+a+s+`
6
+ `;return this.stop(),this.#c.write(c),this}};function m(e){return new p(e)}export{m as default};
@@ -0,0 +1 @@
1
+ import e from"../onetime/index.js";import{onExit as t}from"../signal-exit/dist/mjs/index.js";import n from"node:process";const r=n.stderr.isTTY?n.stderr:n.stdout.isTTY?n.stdout:void 0;var i=r?e(()=>{t(()=>{r.write(`\x1B[?25h`)},{alwaysLast:!0})}):()=>{};export{i as default};
@@ -0,0 +1 @@
1
+ import{signals as e}from"./signals.js";const t=e=>!!e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`,n=Symbol.for(`signal-exit emitter`),r=globalThis,i=Object.defineProperty.bind(Object);var a=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(r[n])return r[n];i(r,n,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){let n=this.listeners[e],r=n.indexOf(t);r!==-1&&(r===0&&n.length===1?n.length=0:n.splice(r,1))}emit(e,t,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let r=!1;for(let i of this.listeners[e])r=i(t,n)===!0||r;return e===`exit`&&(r=this.emit(`afterExit`,t,n)||r),r}},o=class{};const s=e=>({onExit(t,n){return e.onExit(t,n)},load(){return e.load()},unload(){return e.unload()}});var c=class extends o{onExit(){return()=>{}}load(){}unload(){}},l=class extends o{#e=u.platform===`win32`?`SIGINT`:`SIGHUP`;#t=new a;#n;#r;#i;#a={};#o=!1;constructor(t){super(),this.#n=t,this.#a={};for(let n of e)this.#a[n]=()=>{let e=this.#n.listeners(n),{count:r}=this.#t,i=t;if(typeof i.__signal_exit_emitter__==`object`&&typeof i.__signal_exit_emitter__.count==`number`&&(r+=i.__signal_exit_emitter__.count),e.length===r){this.unload();let e=this.#t.emit(`exit`,null,n),r=n===`SIGHUP`?this.#e:n;e||t.kill(t.pid,r)}};this.#i=t.reallyExit,this.#r=t.emit}onExit(e,n){if(!t(this.#n))return()=>{};this.#o===!1&&this.load();let r=n?.alwaysLast?`afterExit`:`exit`;return this.#t.on(r,e),()=>{this.#t.removeListener(r,e),this.#t.listeners.exit.length===0&&this.#t.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#t.count+=1;for(let t of e)try{let e=this.#a[t];e&&this.#n.on(t,e)}catch{}this.#n.emit=(e,...t)=>this.#c(e,...t),this.#n.reallyExit=e=>this.#s(e)}}unload(){this.#o&&(this.#o=!1,e.forEach(e=>{let t=this.#a[e];if(!t)throw Error(`Listener not defined for signal: `+e);try{this.#n.removeListener(e,t)}catch{}}),this.#n.emit=this.#r,this.#n.reallyExit=this.#i,--this.#t.count)}#s(e){return t(this.#n)?(this.#n.exitCode=e||0,this.#t.emit(`exit`,this.#n.exitCode,null),this.#i.call(this.#n,this.#n.exitCode)):0}#c(e,...n){let r=this.#r;if(e===`exit`&&t(this.#n)){typeof n[0]==`number`&&(this.#n.exitCode=n[0]);let t=r.call(this.#n,e,...n);return this.#t.emit(`exit`,this.#n.exitCode,null),t}else return r.call(this.#n,e,...n)}};const u=globalThis.process,{onExit:d,load:f,unload:p}=s(t(u)?new l(u):new c);export{d as onExit};
@@ -0,0 +1 @@
1
+ const e=[];e.push(`SIGHUP`,`SIGINT`,`SIGTERM`),process.platform!==`win32`&&e.push(`SIGALRM`,`SIGABRT`,`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&e.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`);export{e as signals};
@@ -0,0 +1 @@
1
+ import e from"node:process";var t=new class{#e=0;start(){this.#e++,this.#e===1&&this.#t()}stop(){if(this.#e<=0)throw Error("`stop` called more times than `start`");this.#e--,this.#e===0&&this.#n()}#t(){e.platform===`win32`||!e.stdin.isTTY||(e.stdin.setRawMode(!0),e.stdin.on(`data`,this.#r),e.stdin.resume())}#n(){e.stdin.isTTY&&(e.stdin.off(`data`,this.#r),e.stdin.pause(),e.stdin.setRawMode(!1))}#r(t){t[0]===3&&e.emit(`SIGINT`)}};export{t as default};
@@ -0,0 +1 @@
1
+ import e from"../strip-ansi/index.js";import{eastAsianWidth as t}from"../get-east-asian-width/index.js";const n=new Intl.Segmenter,r=/^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Mark}|\p{Surrogate})+$/v,i=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v,a=/^\p{RGI_Emoji}$/v;function o(e){return e.replace(i,``)}function s(e){return r.test(e)}function c(e,n){let r=0;if(e.length>1)for(let i of e.slice(1))i>=`＀`&&i<=`￯`&&(r+=t(i.codePointAt(0),n));return r}function l(r,i={}){if(typeof r!=`string`||r.length===0)return 0;let{ambiguousIsNarrow:l=!0,countAnsiEscapeCodes:u=!1}=i,d=r;if(u||(d=e(d)),d.length===0)return 0;let f=0,p={ambiguousAsWide:!l};for(let{segment:e}of n.segment(d)){if(s(e))continue;if(a.test(e)){f+=2;continue}let n=o(e).codePointAt(0);f+=t(n,p),f+=c(e,p)}return f}export{l as default};
@@ -0,0 +1 @@
1
+ import e from"./node_modules/ansi-regex/index.js";const t=e();function n(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(t,``)}export{n as default};
@@ -0,0 +1 @@
1
+ function e({onlyFirst:e=!1}={}){return RegExp(`(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`,e?void 0:`g`)}export{e as default};
@@ -1 +1 @@
1
- import{validateSpec as e,validateSpecs as t}from"./validate.js";import{validateImplementationFiles as n}from"./validate-implementation.js";import{compareSpecs as r}from"./diff.js";import{analyzeDeps as i,exportGraphAsDot as a,getContractNode as o,getGraphStats as s}from"./deps.js";import{groupSpecsByType as c,listSpecs as l}from"./list.js";import{getApiKey as u,loadWorkspaceConfig as d,mergeWorkspaceConfig as f}from"./config.js";import{buildSpec as p}from"./build.js";import{syncSpecs as m}from"./sync.js";import{watchSpecs as h}from"./watch.js";import{cleanArtifacts as g}from"./clean.js";import{runTests as _}from"./test.js";import{createRegeneratorService as v}from"./regenerator.js";
1
+ import{validateSpec as e,validateSpecs as t}from"./validate.js";import{validateImplementationFiles as n}from"./validate-implementation.js";import{compareSpecs as r}from"./diff.js";import{analyzeDeps as i,exportGraphAsDot as a,getContractNode as o,getGraphStats as s}from"./deps.js";import{groupSpecsByType as c,listSpecs as l}from"./list.js";import{getApiKey as u,loadWorkspaceConfig as d,mergeWorkspaceConfig as f}from"./config.js";import{buildSpec as p}from"./build.js";import{exportOpenApi as m}from"./openapi.js";import{RegistryClient as h,addToRegistry as g,listFromRegistry as _,resolveRegistryUrl as v,searchRegistry as y}from"./registry.js";import{syncSpecs as b}from"./sync.js";import{watchSpecs as x}from"./watch.js";import{cleanArtifacts as S}from"./clean.js";import{runTests as C}from"./test.js";import{createRegeneratorService as w}from"./regenerator.js";
@@ -0,0 +1,2 @@
1
+ import{SpecRegistry as e,openApiForRegistry as t}from"@lssm/lib.contracts";async function n(e,n){let{fs:i,logger:a}=n,{registryPath:o,outputPath:s=`./openapi.json`}=e;a.info(`Loading registry...`,{registryPath:o});let c=await r(o,i);a.info(`Generating OpenAPI document...`);let l=t(c,{title:e.title,version:e.version,description:e.description,servers:e.servers}),u=JSON.stringify(l,null,2)+`
2
+ `,d=i.resolve(s);return await i.mkdir(i.dirname(d)),await i.writeFile(d,u),a.info(`OpenAPI document written to ${d}`),{document:l,outputPath:d,json:u}}async function r(t,n){let r=await import(n.resolve(t));if(r instanceof e)return r;if(r.registry instanceof e)return r.registry;let i=typeof r.createRegistry==`function`?r.createRegistry:typeof r.default==`function`?r.default:void 0;if(i){let t=await i();if(t instanceof e)return t}throw Error(`Registry module ${t} must export a SpecRegistry instance or a factory function returning one.`)}export{n as exportOpenApi};
@@ -0,0 +1 @@
1
+ var e=class{registryUrl;constructor(e){this.registryUrl=e.registryUrl.replace(/\/+$/,``)}async getJson(e){let t=`${this.registryUrl}${e.startsWith(`/`)?``:`/`}${e}`,n;try{n=await fetch(t,{method:`GET`,headers:{Accept:`application/json`}})}catch(e){throw Error(`Registry request failed: ${t} (${e instanceof Error?e.message:String(e)})`)}if(!n.ok){let e=await n.text().catch(()=>``);throw Error(`Registry request failed: ${n.status} ${n.statusText} ${e}`)}return await n.json()}};function t(e){return e||process.env.CONTRACTSPEC_REGISTRY_URL||`http://localhost:8090`}async function n(n,r,i){let{logger:a}=i,o=t(r.registryUrl);a.info(`Adding spec to registry: ${n}`,{registryUrl:o}),await new e({registryUrl:o}).getJson(`/specs/add?path=${encodeURIComponent(n)}`),a.info(`Spec added to registry successfully`)}async function r(n,r){let{logger:i}=r,a=t(n.registryUrl);i.info(`Listing specs from registry`,{registryUrl:a});let o=new e({registryUrl:a}),s=n.filter?`?filter=${encodeURIComponent(n.filter)}`:``,c=await o.getJson(`/specs${s}`);return i.info(`Found ${c.length} specs`),c}async function i(n,r,i){let{logger:a}=i,o=t(r.registryUrl);a.info(`Searching registry: ${n}`,{registryUrl:o});let s=await new e({registryUrl:o}).getJson(`/specs/search?q=${encodeURIComponent(n)}`);return a.info(`Found ${s.length} results`),s}export{e as RegistryClient,n as addToRegistry,r as listFromRegistry,t as resolveRegistryUrl,i as searchRegistry};
@@ -0,0 +1,33 @@
1
+ function e(e){let u=f(e.name.split(`.`).pop()??`App`)+`AppConfig`,d=t(e),m=n(e),h=r(`dataViews`,e.dataViews),g=r(`workflows`,e.workflows),_=i(e),v=a(e),y=o(e),b=s(e),x=c(e),S=l(e),C=e.notes?` notes: '${p(e.notes)}',\n`:``;return`import type { AppBlueprintSpec } from '@lssm/lib.contracts/app-config';
2
+
3
+ export const ${u}: AppBlueprintSpec = {
4
+ meta: {
5
+ name: '${p(e.name)}',
6
+ version: ${e.version},
7
+ title: '${p(e.title)}',
8
+ description: '${p(e.description)}',
9
+ domain: '${p(e.domain)}',
10
+ owners: [${e.owners.map(e=>`'${p(e)}'`).join(`, `)}],
11
+ tags: [${e.tags.map(e=>`'${p(e)}'`).join(`, `)}],
12
+ stability: '${e.stability}',
13
+ appId: '${p(e.appId)}',
14
+ },
15
+ ${d}${m}${h}${g}${_}${v}${y}${b}${x}${S}${C}};\n`}function t(e){return e.capabilitiesEnabled.length===0&&e.capabilitiesDisabled.length===0?``:` capabilities: {\n${e.capabilitiesEnabled.length>0?` enabled: [${e.capabilitiesEnabled.map(e=>u(e)).join(`, `)}],\n`:``}${e.capabilitiesDisabled.length>0?` disabled: [${e.capabilitiesDisabled.map(e=>u(e)).join(`, `)}],\n`:``} },\n`}function n(e){return e.featureIncludes.length===0&&e.featureExcludes.length===0?``:` features: {\n${e.featureIncludes.length>0?` include: [${e.featureIncludes.map(e=>`{ key: '${p(e)}' }`).join(`, `)}],\n`:``}${e.featureExcludes.length>0?` exclude: [${e.featureExcludes.map(e=>`{ key: '${p(e)}' }`).join(`, `)}],\n`:``} },\n`}function r(e,t){return t.length===0?``:` ${e}: {\n${t.map(e=>` ${e.slot}: {
16
+ name: '${p(e.name)}',
17
+ ${typeof e.version==`number`?`version: ${e.version},`:``}
18
+ }`).join(`,
19
+ `)}\n },\n`}function i(e){return e.policyRefs.length===0?``:` policies: [\n${e.policyRefs.map(e=>` {
20
+ name: '${p(e.name)}'${typeof e.version==`number`?`,\n version: ${e.version}`:``}
21
+ }`).join(`,
22
+ `)}\n ],\n`}function a(e){return e.theme?` theme: {\n${` primary: { name: '${p(e.theme.name)}', version: ${e.theme.version} },\n`}${e.themeFallbacks.length>0?` fallbacks: [${e.themeFallbacks.map(e=>`{ name: '${p(e.name)}', version: ${e.version} }`).join(`, `)}],\n`:``} },\n`:``}function o(e){return e.telemetry?` telemetry: {
23
+ spec: {
24
+ name: '${p(e.telemetry.name)}'${typeof e.telemetry.version==`number`?`,\n version: ${e.telemetry.version}`:``}
25
+ },
26
+ },\n`:``}function s(e){return e.activeExperiments.length===0&&e.pausedExperiments.length===0?``:` experiments: {\n${e.activeExperiments.length>0?` active: [${e.activeExperiments.map(e=>d(e)).join(`, `)}],\n`:``}${e.pausedExperiments.length>0?` paused: [${e.pausedExperiments.map(e=>d(e)).join(`, `)}],\n`:``} },\n`}function c(e){return e.featureFlags.length===0?``:` featureFlags: [\n${e.featureFlags.map(e=>` {
27
+ key: '${p(e.key)}',
28
+ enabled: ${e.enabled},
29
+ ${e.variant?`variant: '${p(e.variant)}',`:``}
30
+ ${e.description?`description: '${p(e.description)}',`:``}
31
+ }`).join(`,
32
+ `)}\n ],\n`}function l(e){return e.routes.length===0?``:` routes: [\n${e.routes.map(e=>` { ${[`path: '${p(e.path)}'`,e.label?`label: '${p(e.label)}'`:null,e.dataView?`dataView: '${p(e.dataView)}'`:null,e.workflow?`workflow: '${p(e.workflow)}'`:null,e.guardName?`guard: { name: '${p(e.guardName)}'${typeof e.guardVersion==`number`?`, version: ${e.guardVersion}`:``} }`:null,e.featureFlag?`featureFlag: '${p(e.featureFlag)}'`:null,e.experimentName?`experiment: { name: '${p(e.experimentName)}'${typeof e.experimentVersion==`number`?`, version: ${e.experimentVersion}`:``} }`:null].filter(Boolean).join(`, `)} }`).join(`,
33
+ `)}\n ],\n`}function u(e){return`{ key: '${p(e)}' }`}function d(e){let t=typeof e.version==`number`?`, version: ${e.version}`:``;return`{ name: '${p(e.name)}'${t} }`}function f(e){return e.split(/[-_.]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}function p(e){return e.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`)}export{e as generateAppBlueprintSpec};
@@ -0,0 +1,54 @@
1
+ function e(e){let r=t(e.name.split(`.`).pop()??`DataView`)+`DataView`,i=e.fields.map(e=>` {
2
+ key: '${e.key}',
3
+ label: '${n(e.label)}',
4
+ dataPath: '${e.dataPath}',
5
+ ${e.format?`format: '${e.format}',`:``}
6
+ ${e.sortable?`sortable: true,`:``}
7
+ ${e.filterable?`filterable: true,`:``}
8
+ }`).join(`,
9
+ `),a=e.secondaryFields?.length?`secondaryFields: [${e.secondaryFields.map(e=>`'${e}'`).join(`, `)}],`:``,o=e.itemOperation?`item: { name: '${e.itemOperation.name}', version: ${e.itemOperation.version} },`:``;return`import type { DataViewSpec } from '@lssm/lib.contracts/data-views';
10
+
11
+ export const ${r}: DataViewSpec = {
12
+ meta: {
13
+ name: '${e.name}',
14
+ version: ${e.version},
15
+ entity: '${e.entity}',
16
+ title: '${n(e.title)}',
17
+ description: '${n(e.description||`Describe the purpose of this data view.`)}',
18
+ domain: '${n(e.domain||e.entity)}',
19
+ owners: [${e.owners.map(e=>`'${e}'`).join(`, `)}],
20
+ tags: [${e.tags.map(e=>`'${e}'`).join(`, `)}],
21
+ stability: '${e.stability}',
22
+ },
23
+ source: {
24
+ primary: {
25
+ name: '${e.primaryOperation.name}',
26
+ version: ${e.primaryOperation.version},
27
+ },
28
+ ${o}
29
+ refreshEvents: [
30
+ // { name: 'entity.updated', version: 1 },
31
+ ],
32
+ },
33
+ view: {
34
+ kind: '${e.kind}',
35
+ fields: [
36
+ ${i}
37
+ ],
38
+ ${e.primaryField?`primaryField: '${e.primaryField}',`:``}
39
+ ${a}
40
+ filters: [
41
+ // Example filter:
42
+ // { key: 'search', label: 'Search', field: 'fullName', type: 'search' },
43
+ ],
44
+ actions: [
45
+ // Example action:
46
+ // { key: 'open', label: 'Open', kind: 'navigation' },
47
+ ],
48
+ },
49
+ states: {
50
+ // empty: { name: 'app.data.empty', version: 1 },
51
+ // error: { name: 'app.data.error', version: 1 },
52
+ },
53
+ };
54
+ `}function t(e){return e.split(/[-_.]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}function n(e){return e.replace(/'/g,`\\'`)}export{e as generateDataViewSpec};
@@ -0,0 +1,24 @@
1
+ function e(e){let{name:n,version:r,description:i,stability:a,owners:o,tags:s,piiFields:c}=e,l=t(n.replace(/\./g,`_`))+`V`+r,u=l+`Payload`;return`import { defineEvent } from '@lssm/lib.contracts';
2
+ import { ScalarTypeEnum, SchemaModel } from '@lssm/lib.schema';
3
+
4
+ // TODO: Define event payload schema
5
+ export const ${u} = new SchemaModel({
6
+ name: '${u}',
7
+ description: 'Payload for ${n}',
8
+ fields: {
9
+ // Add your payload fields here
10
+ // example: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
11
+ },
12
+ });
13
+
14
+ export const ${l} = defineEvent({
15
+ name: '${n}',
16
+ version: ${r},
17
+ description: '${i}',
18
+ stability: '${a}',
19
+ owners: [${o.map(e=>`'${e}'`).join(`, `)}],
20
+ tags: [${s.map(e=>`'${e}'`).join(`, `)}],
21
+ ${c.length>0?`pii: [${c.map(e=>`'${e}'`).join(`, `)}],`:`// pii: [],`}
22
+ payload: ${u},
23
+ });
24
+ `}function t(e){return e.split(/[-_.]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}export{e as generateEventSpec};
@@ -0,0 +1,62 @@
1
+ function e(e){let i=n(e.name.split(`.`).pop()??`Experiment`)+`Experiment`,a=e.variants.map(e=>{let t=e.overrides?.length?` overrides: [
2
+ ${e.overrides.map(e=>` {
3
+ type: '${e.type}',
4
+ target: '${r(e.target)}',
5
+ ${typeof e.version==`number`?`version: ${e.version},`:``}
6
+ }`).join(`,
7
+ `)}
8
+ ],`:``;return` {
9
+ id: '${r(e.id)}',
10
+ name: '${r(e.name)}',
11
+ ${e.description?`description: '${r(e.description)}',`:``}
12
+ ${typeof e.weight==`number`?`weight: ${e.weight},`:``}
13
+ ${t}
14
+ }`}).join(`,
15
+ `),o=t(e.allocation),s=e.successMetrics?.length?` successMetrics: [
16
+ ${e.successMetrics.map(e=>` {
17
+ name: '${r(e.name)}',
18
+ telemetryEvent: { name: '${r(e.eventName)}', version: ${e.eventVersion} },
19
+ aggregation: '${e.aggregation}',
20
+ ${typeof e.target==`number`?`target: ${e.target},`:``}
21
+ }`).join(`,
22
+ `)}
23
+ ],`:``;return`import type { ExperimentSpec } from '@lssm/lib.contracts/experiments';
24
+
25
+ export const ${i}: ExperimentSpec = {
26
+ meta: {
27
+ name: '${r(e.name)}',
28
+ version: ${e.version},
29
+ title: '${r(e.name)} experiment',
30
+ description: '${r(e.description||`Describe the experiment goal.`)}',
31
+ domain: '${r(e.domain)}',
32
+ owners: [${e.owners.map(e=>`'${r(e)}'`).join(`, `)}],
33
+ tags: [${e.tags.map(e=>`'${r(e)}'`).join(`, `)}],
34
+ stability: '${e.stability}',
35
+ },
36
+ controlVariant: '${r(e.controlVariant)}',
37
+ variants: [
38
+ ${a}
39
+ ],
40
+ allocation: ${o},
41
+ ${s}
42
+ };
43
+ `}function t(e){switch(e.type){case`random`:return`{
44
+ type: 'random',
45
+ ${e.salt?`salt: '${r(e.salt)}',`:``}
46
+ }`;case`sticky`:return`{
47
+ type: 'sticky',
48
+ attribute: '${e.attribute}',
49
+ ${e.salt?`salt: '${r(e.salt)}',`:``}
50
+ }`;case`targeted`:return`{
51
+ type: 'targeted',
52
+ rules: [
53
+ ${e.rules.map(e=>` {
54
+ variantId: '${r(e.variantId)}',
55
+ ${typeof e.percentage==`number`?`percentage: ${e.percentage},`:``}
56
+ ${e.policy?`policy: { name: '${r(e.policy.name)}'${typeof e.policy.version==`number`?`, version: ${e.policy.version}`:``} },`:``}
57
+ ${e.expression?`expression: '${r(e.expression)}',`:``}
58
+ }`).join(`,
59
+ `)}
60
+ ],
61
+ fallback: '${e.fallback??`control`}',
62
+ }`;default:return i(e)}}function n(e){return e.split(/[-_.]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}function r(e){return e.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`)}function i(e){throw Error(`Unsupported allocation type ${e}`)}export{e as generateExperimentSpec};
@@ -0,0 +1,63 @@
1
+ function e(e,t){let n=r(e.split(`.`).pop()||`unknown`)+`Handler`,o=i(e.split(`.`).pop()||`Unknown`)+`Spec`;return`import type { ContractHandler } from '@lssm/lib.contracts';
2
+ import { ${o} } from '../contracts/${a(e)}.contracts';
3
+
4
+ /**
5
+ * Handler for ${e}
6
+ */
7
+ export const ${n}: ContractHandler<typeof ${o}> = async (
8
+ input,
9
+ context
10
+ ) => {
11
+ // TODO: Implement ${t} logic
12
+
13
+ try {
14
+ // 1. Validate prerequisites
15
+ // 2. Perform business logic
16
+ // 3. Emit events if needed
17
+ // 4. Return result
18
+
19
+ return {
20
+ ok: true,
21
+ };
22
+ } catch (error) {
23
+ // Handle and map errors to spec.io.errors
24
+ throw error;
25
+ }
26
+ };
27
+ `}function t(e,t){let n=i(e);return`import React from 'react';
28
+
29
+ interface ${n}Props {
30
+ // TODO: Define props based on presentation spec
31
+ }
32
+
33
+ /**
34
+ * ${t}
35
+ */
36
+ export const ${n}: React.FC<${n}Props> = (props) => {
37
+ return (
38
+ <div>
39
+ {/* TODO: Implement component UI */}
40
+ <p>Component: ${n}</p>
41
+ </div>
42
+ );
43
+ };
44
+ `}function n(e,t){let n=t===`handler`?`../handlers`:`../components`,r=i(e);return`import { describe, it, expect } from 'bun:test';
45
+ import { ${r} } from '${n}/${a(e)}';
46
+
47
+ describe('${r}', () => {
48
+ it('should ${t===`handler`?`handle valid input`:`render correctly`}', async () => {
49
+ // TODO: Implement test
50
+ expect(true).toBe(true);
51
+ });
52
+
53
+ it('should handle edge cases', async () => {
54
+ // TODO: Test edge cases
55
+ });
56
+
57
+ ${t===`handler`?`it('should handle errors appropriately', async () => {
58
+ // TODO: Test error scenarios
59
+ });`:`it('should be accessible', async () => {
60
+ // TODO: Test accessibility
61
+ });`}
62
+ });
63
+ `}function r(e){let t=i(e);return t.charAt(0).toLowerCase()+t.slice(1)}function i(e){return e.split(/[-_.]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}function a(e){return e.replace(/\./g,`-`).replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}export{t as generateComponentTemplate,e as generateHandlerTemplate,n as generateTestTemplate};
@@ -0,0 +1 @@
1
+ import{__export as e}from"../_virtual/rolldown_runtime.js";import{generateOperationSpec as t}from"./operation.template.js";import{generateEventSpec as n}from"./event.template.js";import{generatePresentationSpec as r}from"./presentation.template.js";import{generateWorkflowSpec as i}from"./workflow.template.js";import{generateMigrationSpec as a}from"./migration.template.js";import{generateTelemetrySpec as o}from"./telemetry.template.js";import{generateExperimentSpec as s}from"./experiment.template.js";import{generateAppBlueprintSpec as c}from"./app-config.template.js";import{generateDataViewSpec as l}from"./data-view.template.js";import{generateIntegrationSpec as u}from"./integration.template.js";import{generateKnowledgeSpaceSpec as d}from"./knowledge.template.js";import{generateComponentTemplate as f,generateHandlerTemplate as p,generateTestTemplate as m}from"./handler.template.js";import{generateWorkflowRunnerTemplate as h}from"./workflow-runner.template.js";var g=e({generateAppBlueprintSpec:()=>c,generateComponentTemplate:()=>f,generateDataViewSpec:()=>l,generateEventSpec:()=>n,generateExperimentSpec:()=>s,generateHandlerTemplate:()=>p,generateIntegrationSpec:()=>u,generateKnowledgeSpaceSpec:()=>d,generateMigrationSpec:()=>a,generateOperationSpec:()=>t,generatePresentationSpec:()=>r,generateTelemetrySpec:()=>o,generateTestTemplate:()=>m,generateWorkflowRunnerTemplate:()=>h,generateWorkflowSpec:()=>i});export{g as templates_exports};
@@ -0,0 +1,75 @@
1
+ function e(e){let s=l(e.name.split(`.`).pop()??`Integration`),d=`${s}IntegrationSpec`,f=`register${s}Integration`,p=e.supportedModes.length?e.supportedModes:[`managed`],m=p.map(e=>`'${e}'`).join(`, `),h=e.capabilitiesProvided.map(e=>` { key: '${e.key}', version: ${e.version} }`).join(`,
2
+ `),g=e.capabilitiesRequired.length>0?` requires: [
3
+ ${e.capabilitiesRequired.map(e=>{let t=typeof e.version==`number`?`, version: ${e.version}`:``,n=e.optional?`, optional: true`:``,r=e.reason?`, reason: '${u(e.reason)}'`:``;return` { key: '${e.key}'${t}${n}${r} }`}).join(`,
4
+ `)}
5
+ ],`:``,_=t(e.configFields),v=r(e.configFields),y=n(e.secretFields),b=i(e.secretFields),x=e.docsUrl?` docsUrl: '${u(e.docsUrl)}',\n`:``,S=a(e.rateLimitRpm,e.rateLimitRph),C=o(p,e.byokSetupInstructions,e.byokRequiredScopes);return`import { StabilityEnum } from '@lssm/lib.contracts/ownership';
6
+ import type { IntegrationSpec } from '@lssm/lib.contracts/integrations/spec';
7
+ import type { IntegrationSpecRegistry } from '@lssm/lib.contracts/integrations/spec';
8
+
9
+ export const ${d}: IntegrationSpec = {
10
+ meta: {
11
+ key: '${e.name}',
12
+ version: ${e.version},
13
+ category: '${e.category}',
14
+ displayName: '${u(e.displayName)}',
15
+ title: '${u(e.title)}',
16
+ description: '${u(e.description)}',
17
+ domain: '${u(e.domain)}',
18
+ owners: [${e.owners.map(e=>`'${u(e)}'`).join(`, `)}],
19
+ tags: [${e.tags.map(e=>`'${u(e)}'`).join(`, `)}],
20
+ stability: StabilityEnum.${c(e.stability)},
21
+ },
22
+ supportedModes: [${m}],
23
+ capabilities: {
24
+ provides: [
25
+ ${h}
26
+ ],
27
+ ${g.length>0?`${g}\n`:``} },
28
+ configSchema: {
29
+ ${_}
30
+ example: ${v},
31
+ },
32
+ secretSchema: {
33
+ ${y}
34
+ example: ${b},
35
+ },
36
+ ${x}${S}${C} healthCheck: {
37
+ method: '${e.healthCheckMethod}',
38
+ timeoutMs: ${e.healthCheckTimeoutMs},
39
+ },
40
+ };
41
+
42
+ export function ${f}(
43
+ registry: IntegrationSpecRegistry
44
+ ): IntegrationSpecRegistry {
45
+ return registry.register(${d});
46
+ }
47
+ `}function t(e){let t=e.filter(e=>e.required);return` schema: {
48
+ type: 'object',
49
+ ${t.length>0?` required: [${t.map(e=>`'${e.key}'`).join(`, `)}],
50
+ `:``} properties: {
51
+ ${(e.length?e.map(e=>{let t=e.description?`, description: '${u(e.description)}'`:``;return` ${e.key}: { type: '${s(e.type)}'${t} }`}).join(`,
52
+ `):``)||` `}
53
+ },
54
+ },\n`}function n(e){let t=e.filter(e=>e.required);return` schema: {
55
+ type: 'object',
56
+ ${t.length>0?` required: [${t.map(e=>`'${e.key}'`).join(`, `)}],
57
+ `:``} properties: {
58
+ ${(e.length?e.map(e=>{let t=e.description?`, description: '${u(e.description)}'`:``;return` ${e.key}: { type: 'string'${t} }`}).join(`,
59
+ `):``)||` `}
60
+ },
61
+ },\n`}function r(e){return e.length===0?`{}`:`{
62
+ ${e.map(e=>{switch(e.type){case`number`:return` ${e.key}: 0`;case`boolean`:return` ${e.key}: true`;case`string`:default:return` ${e.key}: '${e.key.toUpperCase()}_VALUE'`}}).join(`,
63
+ `)}
64
+ }`}function i(e){return e.length===0?`{}`:`{
65
+ ${e.map(e=>` ${e.key}: '${e.key.toUpperCase()}_SECRET'`).join(`,
66
+ `)}
67
+ }`}function a(e,t){if(e==null&&t==null)return``;let n=[];return e!=null&&n.push(` rpm: ${e}`),t!=null&&n.push(` rph: ${t}`),` constraints: {
68
+ rateLimit: {
69
+ ${n.join(`,
70
+ `)}
71
+ },
72
+ },
73
+ `}function o(e,t,n){if(!e.includes(`byok`))return``;let r=t?` setupInstructions: '${u(t)}',\n`:``,i=n&&n.length?` requiredScopes: [${n.map(e=>`'${u(e)}'`).join(`, `)}],\n`:``;return!r&&!i?``:` byokSetup: {
74
+ ${r}${i} },
75
+ `}function s(e){switch(e){case`number`:return`number`;case`boolean`:return`boolean`;case`string`:default:return`string`}}function c(e){switch(e){case`beta`:return`Beta`;case`stable`:return`Stable`;case`deprecated`:return`Deprecated`;case`experimental`:default:return`Experimental`}}function l(e){return e.split(/[-_.]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}function u(e){return e.replace(/`/g,"\\`").replace(/'/g,`\\'`)}export{e as generateIntegrationSpec};
@@ -0,0 +1,33 @@
1
+ function e(e){let s=a(e.name.split(`.`).pop()??`KnowledgeSpace`),c=`${s}KnowledgeSpace`,l=`register${s}KnowledgeSpace`,u=t(e),d=n(e),f=r(e),p=e.policyName&&!e.policyVersion?` // defaults to latest version`:``;return`import { StabilityEnum } from '@lssm/lib.contracts/ownership';
2
+ import type { KnowledgeSpaceSpec } from '@lssm/lib.contracts/knowledge/spec';
3
+ import type { KnowledgeSpaceRegistry } from '@lssm/lib.contracts/knowledge/spec';
4
+
5
+ export const ${c}: KnowledgeSpaceSpec = {
6
+ meta: {
7
+ key: '${e.name}',
8
+ version: ${e.version},
9
+ category: '${e.category}',
10
+ displayName: '${o(e.displayName)}',
11
+ title: '${o(e.title)}',
12
+ description: '${o(e.description)}',
13
+ domain: '${o(e.domain)}',
14
+ owners: [${e.owners.map(e=>`'${o(e)}'`).join(`, `)}],
15
+ tags: [${e.tags.map(e=>`'${o(e)}'`).join(`, `)}],
16
+ stability: StabilityEnum.${i(e.stability)},
17
+ },
18
+ retention: ${u},
19
+ access: {
20
+ ${d}${e.policyName?` policy: { name: '${e.policyName}',${e.policyVersion?` version: ${e.policyVersion}`:``} },${p}\n`:``} },
21
+ ${f} description: '${o(e.description||e.displayName)}',
22
+ };
23
+
24
+ export function ${l}(
25
+ registry: KnowledgeSpaceRegistry
26
+ ): KnowledgeSpaceRegistry {
27
+ return registry.register(${c});
28
+ }
29
+ `}function t(e){return`{ ttlDays: ${e.retention.ttlDays===null?`null`:typeof e.retention.ttlDays==`number`?String(e.retention.ttlDays):`null`}${typeof e.retention.archiveAfterDays==`number`?`, archiveAfterDays: ${e.retention.archiveAfterDays}`:``} }`}function n(e){return`${` trustLevel: '${e.trustLevel}',\n`}${` automationWritable: ${e.automationWritable},\n`}`}function r(e){let t=[];return e.embeddingModel&&t.push(` embeddingModel: '${o(e.embeddingModel)}'`),typeof e.chunkSize==`number`&&t.push(` chunkSize: ${e.chunkSize}`),e.vectorDbIntegration&&t.push(` vectorDbIntegration: '${o(e.vectorDbIntegration)}'`),t.length===0?``:` indexing: {
30
+ ${t.join(`,
31
+ `)}
32
+ },
33
+ `}function i(e){switch(e){case`beta`:return`Beta`;case`stable`:return`Stable`;case`deprecated`:return`Deprecated`;case`experimental`:default:return`Experimental`}}function a(e){return e.split(/[-_.]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}function o(e){return e.replace(/`/g,"\\`").replace(/'/g,`\\'`)}export{e as generateKnowledgeSpaceSpec};
@@ -0,0 +1,37 @@
1
+ function e(e){let i=`${n(e.name.split(`.`).pop()??`Migration`)}Migration`,a=e.dependencies.length>0?`dependencies: [${e.dependencies.map(e=>`'${e}'`).join(`, `)}],`:``;return`import type { MigrationSpec } from '@lssm/lib.contracts/migrations';
2
+
3
+ export const ${i}: MigrationSpec = {
4
+ meta: {
5
+ name: '${e.name}',
6
+ version: ${e.version},
7
+ title: '${r(e.title)}',
8
+ description: '${r(e.description??``)}',
9
+ domain: '${r(e.domain)}',
10
+ owners: [${e.owners.map(e=>`'${e}'`).join(`, `)}],
11
+ tags: [${e.tags.map(e=>`'${e}'`).join(`, `)}],
12
+ stability: '${e.stability}',
13
+ },
14
+ plan: {
15
+ up: [
16
+ ${t(e.up)}
17
+ ],${e.down&&e.down.length?`
18
+ down: [
19
+ ${t(e.down)}
20
+ ],`:``}
21
+ },
22
+ ${a}
23
+ };
24
+ `}function t(e){return e.map(e=>{let t=e.description?`description: '${r(e.description)}',`:``;switch(e.kind){case`schema`:return` {
25
+ kind: 'schema',
26
+ ${t}
27
+ sql: \`${r(e.sql??``)}\`,
28
+ }`;case`data`:return` {
29
+ kind: 'data',
30
+ ${t}
31
+ script: \`${r(e.script??``)}\`,
32
+ }`;case`validation`:default:return` {
33
+ kind: 'validation',
34
+ ${t}
35
+ assertion: \`${r(e.assertion??``)}\`,
36
+ }`}}).join(`,
37
+ `)}function n(e){return e.split(/[-_.]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}function r(e){return e.replace(/`/g,"\\`").replace(/'/g,`\\'`)}export{e as generateMigrationSpec};
@@ -0,0 +1,88 @@
1
+ function e(e){let{name:r,version:i,kind:a,description:o,goal:s,context:c,stability:l,owners:u,tags:d,auth:f,flags:p}=e,m=n(r.split(`.`).pop()||`Unknown`)+`Spec`,h=m.replace(`Spec`,`Input`),g=m.replace(`Spec`,`Output`);return`import { define${t(a)} } from '@lssm/lib.contracts';
2
+ import { ScalarTypeEnum, SchemaModel } from '@lssm/lib.schema';
3
+
4
+ // TODO: Define input schema
5
+ export const ${h} = new SchemaModel({
6
+ name: '${h}',
7
+ description: 'Input for ${r}',
8
+ fields: {
9
+ // Add your fields here
10
+ // example: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
11
+ },
12
+ });
13
+
14
+ // TODO: Define output schema
15
+ export const ${g} = new SchemaModel({
16
+ name: '${g}',
17
+ description: 'Output for ${r}',
18
+ fields: {
19
+ // Add your fields here
20
+ ok: { type: ScalarTypeEnum.Boolean(), isOptional: false },
21
+ },
22
+ });
23
+
24
+ export const ${m} = define${t(a)}({
25
+ meta: {
26
+ name: '${r}',
27
+ version: ${i},
28
+ stability: '${l}',
29
+ owners: [${u.map(e=>`'${e}'`).join(`, `)}],
30
+ tags: [${d.map(e=>`'${e}'`).join(`, `)}],
31
+ description: '${o}',
32
+ goal: '${s}',
33
+ context: '${c}',
34
+ },
35
+
36
+ io: {
37
+ input: ${h},
38
+ output: ${g},
39
+ errors: {
40
+ // Define possible errors
41
+ // EXAMPLE_ERROR: {
42
+ // description: 'Example error description',
43
+ // http: 400,
44
+ // when: 'When this error occurs',
45
+ // },
46
+ },
47
+ },
48
+
49
+ policy: {
50
+ auth: '${f}',
51
+ ${p.length>0?`flags: [${p.map(e=>`'${e}'`).join(`, `)}],`:`// flags: [],`}
52
+ },
53
+
54
+ sideEffects: {
55
+ ${e.emitsEvents?`emits: [
56
+ // Define events to emit
57
+ // { ref: SomeEventSpec, when: 'always' }
58
+ ],`:`// emits: [],`}
59
+ analytics: [
60
+ // Define analytics events
61
+ ],
62
+ },
63
+
64
+ transport: {
65
+ rest: { method: '${a===`command`?`POST`:`GET`}' },
66
+ gql: { field: '${r.replace(/\./g,`_`)}' },
67
+ mcp: { toolName: '${r}.v${i}' },
68
+ },
69
+
70
+ acceptance: {
71
+ scenarios: [
72
+ {
73
+ name: 'Happy path',
74
+ given: ['preconditions'],
75
+ when: ['action taken'],
76
+ then: ['expected outcome'],
77
+ },
78
+ ],
79
+ examples: [
80
+ {
81
+ name: 'Example usage',
82
+ input: { /* example input */ },
83
+ output: { ok: true },
84
+ },
85
+ ],
86
+ },
87
+ });
88
+ `}function t(e){return e.charAt(0).toUpperCase()+e.slice(1)}function n(e){return e.split(/[-_.]/).map(t).join(``)}export{e as generateOperationSpec};
@@ -0,0 +1,53 @@
1
+ function e(e){let{name:n,version:r,description:i,stability:a,owners:o,tags:s,presentationKind:c}=e,l=t(n.replace(/\./g,`_`))+`Presentation`,u=``;switch(c){case`web_component`:u=` content: {
2
+ kind: 'web_component',
3
+ framework: 'react',
4
+ componentKey: '${n.replace(/\./g,`_`)}',
5
+ props: new SchemaModel({
6
+ name: '${l}Props',
7
+ description: 'Props for ${n}',
8
+ fields: {
9
+ // TODO: Define component props
10
+ },
11
+ }),
12
+ analytics: [
13
+ // TODO: Define analytics events
14
+ ],
15
+ },`;break;case`markdown`:u=` content: {
16
+ kind: 'markdown',
17
+ content: \`
18
+ # ${i}
19
+
20
+ TODO: Add markdown content here
21
+ \`,
22
+ // Or use resourceUri: 'feature://${n}/guide.md'
23
+ },`;break;case`data`:u=` content: {
24
+ kind: 'data',
25
+ mimeType: 'application/json',
26
+ model: new SchemaModel({
27
+ name: '${l}Data',
28
+ description: 'Data structure for ${n}',
29
+ fields: {
30
+ // TODO: Define data structure
31
+ },
32
+ }),
33
+ },`;break}return`import type { PresentationSpec } from '@lssm/lib.contracts/presentations';
34
+ import { SchemaModel, ScalarTypeEnum } from '@lssm/lib.schema';
35
+
36
+ export const ${l}: PresentationSpec = {
37
+ meta: {
38
+ name: '${n}',
39
+ version: ${r},
40
+ stability: '${a}',
41
+ owners: [${o.map(e=>`'${e}'`).join(`, `)}],
42
+ tags: [${s.map(e=>`'${e}'`).join(`, `)}],
43
+ description: '${i}',
44
+ },
45
+
46
+ policy: {
47
+ // flags: [],
48
+ // pii: [],
49
+ },
50
+
51
+ ${u}
52
+ };
53
+ `}function t(e){return e.split(/[-_.]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}export{e as generatePresentationSpec};