noskills 4.1.55 → 4.5.0
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/LICENSE +13 -0
- package/README.md +106 -58
- package/chunks/ajan-bridge-T5M4DPDT.js +1 -0
- package/chunks/anthropic-TS7EMQML.js +1 -0
- package/chunks/approve-HEW3VFYH.js +1 -0
- package/chunks/ask-AXHTCVD6.js +2 -0
- package/chunks/block-VN76CXZW.js +1 -0
- package/chunks/{browser-XLYVEO2J.js → browser-BGFD24RX.js} +1 -1
- package/chunks/bun-WZ7BVR7Y.js +1 -0
- package/chunks/cancel-7WRAST62.js +1 -0
- package/chunks/chunk-3ZJ3UGQL.js +48 -0
- package/chunks/chunk-4PF2MT7S.js +29 -0
- package/chunks/chunk-575Y3OEG.js +1 -0
- package/chunks/{chunk-DZTBXXB3.js → chunk-5DZHAHXW.js} +23 -23
- package/chunks/chunk-5PBNUBBY.js +3 -0
- package/chunks/{chunk-HNAHPI6V.js → chunk-5RLCKUIF.js} +1 -1
- package/chunks/chunk-6YSS6PEL.js +3 -0
- package/chunks/chunk-7GC46XEU.js +1 -0
- package/chunks/{chunk-LBPD4EIH.js → chunk-7PPUGTKL.js} +1 -1
- package/chunks/chunk-AUZWXMWA.js +27 -0
- package/chunks/chunk-CH6A3LES.js +91 -0
- package/chunks/{chunk-UG26APX2.js → chunk-CML74SNT.js} +1 -1
- package/chunks/chunk-CTTMQSHF.js +1 -0
- package/chunks/chunk-DBKXMYLF.js +4 -0
- package/chunks/chunk-DEHRWREM.js +1 -0
- package/chunks/chunk-EIGFDYGQ.js +1 -0
- package/chunks/chunk-EIMBEXUJ.js +1 -0
- package/chunks/chunk-EJYSOUEA.js +1 -0
- package/chunks/chunk-ENP4P2YH.js +0 -0
- package/chunks/{chunk-RJX4ZXQ4.js → chunk-EROZRDGT.js} +1 -1
- package/chunks/chunk-FE4MKOI4.js +1 -0
- package/chunks/chunk-GQTHILPL.js +5 -0
- package/chunks/chunk-HISXAZ4Y.js +1 -0
- package/chunks/chunk-I4Z2RF7L.js +31 -0
- package/chunks/chunk-IFE5SYGK.js +1 -0
- package/chunks/chunk-IGDFEGCH.js +2 -0
- package/chunks/chunk-JL3MAFYQ.js +1 -0
- package/chunks/chunk-JYVB6UAV.js +1 -0
- package/chunks/chunk-KJLEPI7T.js +1 -0
- package/chunks/chunk-KM64FL2X.js +1 -0
- package/chunks/chunk-KMLNG3EC.js +1 -0
- package/chunks/chunk-KRKOWSYW.js +148 -0
- package/chunks/chunk-KRRPOVQG.js +1 -0
- package/chunks/{chunk-CKETVOVQ.js → chunk-LJEWPIEI.js} +1 -1
- package/chunks/{chunk-VAP3TSYK.js → chunk-LN4NDYT6.js} +1 -1
- package/chunks/{chunk-Z3O5HAIO.js → chunk-NGCBWJML.js} +1 -1
- package/chunks/chunk-O4KKKYCH.js +1 -0
- package/chunks/chunk-OAWYVETM.js +1 -0
- package/chunks/chunk-PKEQKXZW.js +23 -0
- package/chunks/chunk-PRQ5CRIG.js +1 -0
- package/chunks/{chunk-SWYX6WYQ.js → chunk-PSX63TYP.js} +2 -2
- package/chunks/{chunk-5P46WSNG.js → chunk-Q4TI7EYT.js} +1 -1
- package/chunks/chunk-QKWJ72HI.js +3 -0
- package/chunks/chunk-RAQY37P6.js +1 -0
- package/chunks/{openai-QGEN33SU.js → chunk-S4MUTKHT.js} +3 -3
- package/chunks/chunk-SLO22P65.js +1 -0
- package/chunks/chunk-UE56BMAW.js +21 -0
- package/chunks/{chunk-O2NUECRA.js → chunk-VJRCTYGL.js} +1 -1
- package/chunks/chunk-VXU6XZ66.js +39 -0
- package/chunks/chunk-W4TQLLUK.js +7 -0
- package/chunks/{chunk-PKYW3S5P.js → chunk-XDRX4ZBJ.js} +1 -1
- package/chunks/{chunk-XNGHRJVK.js → chunk-Y5E7ZCCX.js} +1 -1
- package/chunks/chunk-Z7OYXH3J.js +1 -0
- package/chunks/claude-code-DIWRQKZA.js +1 -0
- package/chunks/cmd-46ZIHXLB.js +1 -0
- package/chunks/concern-QSENGU6C.js +1 -0
- package/chunks/{config-CZDLCSOC.js → config-S3UXTJN2.js} +1 -1
- package/chunks/decision-ledger-GY2W6VWL.js +1 -0
- package/chunks/delegate-WKXIER7E.js +1 -0
- package/chunks/deno-YM5PW6ZM.js +1 -0
- package/chunks/{diagrams-H7NLJF7W.js → diagrams-A7W2EBYV.js} +1 -1
- package/chunks/diagrams-CBCUA47B.js +1 -0
- package/chunks/{dist-UI3SRKS3.js → dist-3MH5UCQU.js} +3 -3
- package/chunks/done-WR3UFYJT.js +1 -0
- package/chunks/followup-5EGZEF5Q.js +1 -0
- package/chunks/free-KJQHRYZA.js +1 -0
- package/chunks/gemini-IWP24T63.js +1 -0
- package/chunks/init-437SU6XH.js +1 -0
- package/chunks/invoke-hook-LMCWNF65.js +13 -0
- package/chunks/kiro-THWCXS5L.js +1 -0
- package/chunks/{learn-KIZTV5OH.js → learn-ZTYKBZER.js} +1 -1
- package/chunks/ledger-FOOPJ2UO.js +1 -0
- package/chunks/list-HNGIOVBK.js +1 -0
- package/chunks/loader-command-3A5FK2RF.js +1 -0
- package/chunks/loader-reactor-YZM7HO4G.js +1 -0
- package/chunks/manager-2MOLEJ4Q.js +3 -0
- package/chunks/mod-6EZYRKWV.js +1 -0
- package/chunks/{mod-TYCXSLSH.js → mod-7VTKN6Q5.js} +1 -1
- package/chunks/mod-7X5TKHKC.js +1 -0
- package/chunks/mod-AJIRKRAH.js +1 -0
- package/chunks/mod-SFSUQWSB.js +8 -0
- package/chunks/mod-TGOMO3CJ.js +1 -0
- package/chunks/{multipart-parser-UVM6CEKF.js → multipart-parser-DKDFOZKD.js} +1 -1
- package/chunks/next-Y6FOPM4Z.js +15 -0
- package/chunks/node-AZK2C657.js +12 -0
- package/chunks/node-GQQ42DT2.js +68 -0
- package/chunks/node-J4GTOSL2.js +1 -0
- package/chunks/ollama-2KAMCXVL.js +1 -0
- package/chunks/openai-HHE35TAX.js +31 -0
- package/chunks/openai-YES2XJDU.js +1 -0
- package/chunks/opencode-S4M7WJTO.js +1 -0
- package/chunks/{pack-33LQ7SJT.js → pack-KUT53Z24.js} +4 -4
- package/chunks/plan-export-PG2BVRQZ.js +3 -0
- package/chunks/purge-JGNJNEET.js +4 -0
- package/chunks/reopen-RPDXN3CF.js +1 -0
- package/chunks/reset-RBCQO2RF.js +1 -0
- package/chunks/review-VMS5MYOV.js +1 -0
- package/chunks/{rule-XREVPB5P.js → rule-IB4VKSBC.js} +2 -2
- package/chunks/run-62PWXVII.js +3 -0
- package/chunks/sdk-FR7Z4YSC.js +1 -0
- package/chunks/{session-HBP5GGI2.js → session-Q43KMFL2.js} +1 -1
- package/chunks/spec-4RKLPOEM.js +1 -0
- package/chunks/{src-GLQPTDNR.js → src-HXQVVTGQ.js} +1 -1
- package/chunks/status-OGLFEFF7.js +1 -0
- package/chunks/sync-H35O5DN5.js +1 -0
- package/chunks/{unstable_chmod-RZ5DE3XZ.js → unstable_chmod-44MCKF3B.js} +1 -1
- package/chunks/validate-JX7UTAK5.js +1 -0
- package/chunks/vertexai-WF5CKMYI.js +1 -0
- package/chunks/watch-SOZDHLSC.js +8 -0
- package/chunks/web-3VGRM3W4.js +1 -0
- package/chunks/wontfix-RBOGLLWJ.js +1 -0
- package/chunks/workerd-I7MLRCLJ.js +1 -0
- package/noskills.js +1 -1
- package/package.json +2 -2
- package/chunks/anthropic-LDUWIUPL.js +0 -1
- package/chunks/approve-73ZFRV7E.js +0 -1
- package/chunks/ask-VGI3BFZW.js +0 -2
- package/chunks/block-5APPOQQK.js +0 -1
- package/chunks/bun-5VMFSLLY.js +0 -1
- package/chunks/cancel-ZYRZPFRH.js +0 -1
- package/chunks/chunk-2GF5IUQD.js +0 -39
- package/chunks/chunk-2N4GTHXQ.js +0 -1
- package/chunks/chunk-5CNPFLE6.js +0 -1
- package/chunks/chunk-5MN3MWQN.js +0 -1
- package/chunks/chunk-65A35QPF.js +0 -1
- package/chunks/chunk-7UX6WIXX.js +0 -1
- package/chunks/chunk-AGPCY6XP.js +0 -1
- package/chunks/chunk-AGWPQX43.js +0 -31
- package/chunks/chunk-AP3YBNPX.js +0 -1
- package/chunks/chunk-D3IKJ7FF.js +0 -1
- package/chunks/chunk-EKZXJCT7.js +0 -5
- package/chunks/chunk-H77MLIL5.js +0 -4
- package/chunks/chunk-JVCVWI3B.js +0 -3
- package/chunks/chunk-OLM5RTFK.js +0 -1
- package/chunks/chunk-OTRBRRIO.js +0 -1
- package/chunks/chunk-U5SHLIO4.js +0 -3
- package/chunks/chunk-UT6ZCLRA.js +0 -1
- package/chunks/chunk-XS5JHAC7.js +0 -1
- package/chunks/chunk-XXBSEOQR.js +0 -148
- package/chunks/chunk-YSLRAWBK.js +0 -1
- package/chunks/chunk-YSSDQJTT.js +0 -91
- package/chunks/chunk-YTNM7A5Y.js +0 -3
- package/chunks/claude-code-BWCSAVK2.js +0 -1
- package/chunks/cmd-ZXO6KFK6.js +0 -1
- package/chunks/concern-RB444PUE.js +0 -1
- package/chunks/delegate-QBPFR44C.js +0 -1
- package/chunks/deno-QOH6TCLQ.js +0 -1
- package/chunks/diagrams-I2QKL7WR.js +0 -1
- package/chunks/done-Z2MFKQ45.js +0 -1
- package/chunks/followup-JR63B3JS.js +0 -1
- package/chunks/free-R4ZTZ76O.js +0 -1
- package/chunks/gemini-YR5KT32S.js +0 -1
- package/chunks/init-F7JCAPQS.js +0 -1
- package/chunks/invoke-hook-CGV6UHU7.js +0 -13
- package/chunks/kiro-RGYUKJAX.js +0 -3
- package/chunks/list-6EQP6VUL.js +0 -1
- package/chunks/manager-R5KNPWLT.js +0 -6
- package/chunks/mod-A77UWGGG.js +0 -1
- package/chunks/next-J2YKXUKA.js +0 -7
- package/chunks/node-3FTYLC7H.js +0 -67
- package/chunks/node-BPWE6I45.js +0 -1
- package/chunks/ollama-LTZ43OHQ.js +0 -3
- package/chunks/openai-Y74OQTVB.js +0 -23
- package/chunks/opencode-PZDL7VDP.js +0 -1
- package/chunks/purge-G22VY6CI.js +0 -4
- package/chunks/reopen-JTFZBGHT.js +0 -1
- package/chunks/reset-AW2IS3F6.js +0 -1
- package/chunks/review-EESYDNMA.js +0 -1
- package/chunks/run-K7FAF7RR.js +0 -3
- package/chunks/sdk-6IMATOQ3.js +0 -40
- package/chunks/spec-5B3HC5PT.js +0 -1
- package/chunks/status-CQ4U3KBF.js +0 -1
- package/chunks/sync-TJLHMISX.js +0 -1
- package/chunks/vertexai-RUXZ24C2.js +0 -1
- package/chunks/watch-WCX4YBL5.js +0 -8
- package/chunks/web-PEDL6264.js +0 -1
- package/chunks/wontfix-7JMQAMWG.js +0 -1
- package/chunks/workerd-IIQRIOBX.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var l={id:"open-source",name:"Open Source",description:"Community-driven, inclusive, well-documented. Prioritize contributor experience, avoid exclusionary patterns, default to permissive choices.",category:"values",extras:[{questionId:"status_quo",text:"Is this workaround common in the community?"},{questionId:"user_impact",text:"Does this make contribution harder?"},{questionId:"verification",text:"Can a new contributor understand and modify this within 30 minutes of reading?"},{questionId:"ambition",text:"What does a thriving, active contributor community look like for this project in 12 months? What would make someone want to contribute vs. just use it?"},{questionId:"scope_boundary",text:"Does this change affect the contributor path (CONTRIBUTING.md, dev setup, CI, issue templates)? If yes, update it in the same task."}],specSections:[{id:"contributor-guide",title:"Contributor Guide",placeholder:"_Describe the contributor pathway: forking, dev environment setup, submitting a PR. What is the Time-To-First-Contribution? List every manual step._",condition:null,position:"after:acceptance-criteria"},{id:"public-api-surface",title:"Public API Surface",placeholder:"_Map every public export, CLI flag, and config option touched by this change. Are names self-explanatory without docs? Any breaking changes?_",condition:null,position:"after:acceptance-criteria"},{id:"release-notes",title:"Release Notes",placeholder:"_Draft the release notes for this change. Audience: users upgrading from the previous version. Focus on what changes for them, not on implementation details._",condition:null,position:"after:acceptance-criteria"}],reminders:["Endpoint should be documented in API docs","Consider contributor experience for new patterns","Default to permissive, well-documented choices","New features and API changes must be documented so contributors can discover and use them","OSS Prime Directive: a first-time contributor should be able to fork, modify, and submit a PR within 30 minutes. Track your setup steps \u2014 every undocumented step is a contributor you lose.","OSS Prime Directive: CHANGELOG must be updated with every user-facing change. Contributors need to know what changed between releases.","OSS Prime Directive: Default to the simplest thing that works. Clever code is a barrier; readable code is a welcome mat.","Permissive licenses (MIT, Apache 2.0) by default. Any copyleft dependency needs explicit justification and legal review."],acceptanceCriteria:["Public API documented","Changes reflected in README or relevant docs","No exclusionary patterns introduced","CHANGELOG updated for any user-facing change","CONTRIBUTING.md exists and is accurate after this change","CI pipeline passes \u2014 external contributors can fork and get green CI without manual intervention","No new hard-coded environment assumptions (absolute paths, machine-specific config) that would break on a contributor's machine"],reviewDimensions:[{id:"contributor-onboarding",label:"Contributor Onboarding",prompt:"Walk through the contributor journey: clone \u2192 install \u2192 run \u2192 modify \u2192 test \u2192 PR. Where does it break? What's undocumented? What would confuse someone seeing this repo for the first time?",evidenceRequired:!0,scope:"all"},{id:"api-surface-quality",label:"API Surface Quality",prompt:"Review every public export, CLI flag, and config option touched by this change. Are names self-explanatory? Are defaults sensible? Is progressive disclosure working (simple things simple, complex things possible)?",evidenceRequired:!0,scope:"api"},{id:"docs-findability",label:"Documentation Findability",prompt:"For each new feature: can a user discover it from README? Are code examples copy-paste runnable? Is there a gap between 'documented' and 'findable'?",evidenceRequired:!0,scope:"all"},{id:"contributor-friction",label:"Contributor Friction Score",prompt:"Count the number of manual steps a new contributor must take from `git clone` to `first successful test run`. Score: 0-2 steps = excellent, 3-5 = acceptable, 6+ = blocking. List every step, flag every friction point. Are setup prerequisites documented? Are error messages helpful when setup fails?",evidenceRequired:!0,scope:"all"},{id:"license-consistency",label:"License Consistency",prompt:"Check every new dependency introduced by this change: is its license compatible with this project's license? Any copyleft (GPL, LGPL, AGPL) license in a library used by an MIT project is a legal landmine. List every new dependency, its license, and compatibility verdict.",evidenceRequired:!1,scope:"all"}],dreamStatePrompt:"In 12 months, what does a healthy contributor community look like for this codebase? New contributors submit first PRs within a day. Existing contributors can find their way around any module. Issues have clear reproduction steps. PRs get reviewed in 48 hours. CHANGELOG reads like a product changelog, not a commit log."};var h={id:"beautiful-product",name:"Beautiful Product",description:"Design and UX are first-class. Agent critiques UI/UX like a passionate designer. Empty states, error states, loading states, mobile layout \u2014 nothing ships unspecified.",category:"values",extras:[{questionId:"status_quo",text:"How painful is the current experience?"},{questionId:"status_quo",text:"What does the current UI look like? Rate it 0-10 on design intentionality."},{questionId:"ambition",text:"In the 10-star version, what does the user feel?"},{questionId:"ambition",text:"What would a 10/10 design look like for this feature? Describe the emotional response you want from users."},{questionId:"ambition",text:"What makes this UI NOT look AI-generated? Name specific design decisions that differentiate it from generic templates."},{questionId:"verification",text:"How will you verify design quality? Will you review empty states, loading states, error states, and edge cases (long text, zero results, slow connection)?"},{questionId:"user_impact",text:"What is the emotional arc? Curiosity \u2192 understanding \u2192 action \u2192 satisfaction? Where does it break today? Where does it feel mechanical instead of crafted?"}],specSections:[{id:"design-states",title:"Design States (empty, loading, error, success)",placeholder:"_For every UI component in this change, specify: loading state, empty state, error state, success state, partial state. No placeholders \u2014 each state must be designed._",condition:"involvesWebUI",position:"after:acceptance-criteria"},{id:"mobile-layout",title:"Mobile Layout",placeholder:"_Describe the mobile layout. Touch targets (\u226544\xD744px)? Viewport behavior? Which breakpoints apply? What collapses or reflows on small screens?_",condition:"involvesWebUI",position:"after:acceptance-criteria"},{id:"interaction-design",title:"Interaction Design",placeholder:"_Describe the interaction model: tap targets, hover states, focus management, animation intent, keyboard navigation. For multi-step flows: back/escape/abandonment behavior._",condition:"involvesWebUI",position:"after:acceptance-criteria"},{id:"accessibility",title:"Accessibility",placeholder:"_Keyboard navigation, focus indicators, ARIA labels, contrast (WCAG 2.1 AA: 4.5:1 text, 3:1 UI), screen reader behavior. List every interactive element and its accessible name._",condition:"involvesWebUI",position:"after:acceptance-criteria"}],conductRules:{DISCOVERY:["For any UI work, ask about empty, loading, error, and success states explicitly \u2014 do not assume they are obvious.","For any flow with more than 2 steps, ask about back, escape, and abandonment behavior."],DISCOVERY_REFINEMENT:["During completeness assessment, check the design-states section specifically \u2014 missing UI state specs are a verification-strategy gap.","If classification.involvesWebUI is true (check state.classification), recommend selective-expansion posture to deepen UI state coverage. If classification is null, skip this check."],EXECUTING:["Before marking any UI task complete, check for AI slop patterns (generic gradients, default shadows, Lorem Ipsum, default Bootstrap/Tailwind without customization).","Rate each UI change 0-10 on design intentionality. Do not mark AC passed if rating is below 7."]},reminders:["Loading state and error state must be designed, not placeholder","No AI slop \u2014 every UI element is intentional","Empty states need clear CTAs with examples","Rate each UI change 0-10 on design intentionality before marking task complete. If below 7, iterate.","Check all interaction states: loading, empty, error, success, partial. Missing states are bugs, not TODOs.","Edge case check: what happens with 47-character names? Zero results? Network failure mid-action?","AI SLOP BLACKLIST \u2014 reject these patterns in any UI implementation: (1) Purple/violet gradient backgrounds (2) 3-column feature grid with icon-in-circle + bold title + 2-line description (3) Icons in colored circles as decoration (4) Everything centered (text-align: center on all elements) (5) Uniform bubbly border-radius on every element (6) Decorative blobs, floating circles, wavy SVG dividers (7) Emoji as design elements in headings or bullets (8) Colored left-border on cards (9) Generic hero copy ('Welcome to X', 'Unlock the power of...') (10) Cookie-cutter section rhythm (hero \u2192 3 features \u2192 testimonials \u2192 pricing). If the implementation matches any of these patterns, reject it and ask for a redesign with specific, intentional alternatives.","7-PASS DESIGN REVIEW before marking any UI task done: (1) Information hierarchy \u2014 what does the user see first? (2) Interaction states \u2014 all states specified? (3) Edge cases \u2014 long text, zero results, errors? (4) Accessibility \u2014 keyboard, contrast, touch targets? (5) Design system \u2014 consistent tokens? (6) AI Slop Litmus \u2014 does this look generated or designed? (7) Emotional arc \u2014 does the journey feel crafted?","LANDING PAGE RULES (when involvesWebUI): The 5-second test \u2014 does a cold visitor know what this does in 5 seconds? The skeptic test \u2014 what's the biggest objection a visitor has, and does the page address it above the fold? Social proof before CTA \u2014 never ask for commitment before establishing trust.","Design rating rubric: 0-4 = unacceptable (AI-generated look, missing states, broken on mobile), 5-6 = passable (functional, but generic), 7-8 = good (intentional, complete states, on-brand), 9-10 = exceptional (delightful, memorable, exceeds expectations). Do not ship below 7."],acceptanceCriteria:["All UI states designed (empty, loading, error, success)","Mobile layout considered","No placeholder or skeleton UI left unfinished","All UI states specified and implemented: loading, empty, error, success, partial","No placeholder text in shipped UI \u2014 every empty state has warmth, a primary action, and context","Design rated 7+ on intentionality by the spec author","Basic accessibility: keyboard navigation works, focus indicators visible, sufficient contrast","Text contrast passes WCAG 2.1 AA (4.5:1 for normal text, 3:1 for large text)","Touch targets are minimum 44x44px on mobile","No AI slop patterns from the blacklist present in the shipped UI"],reviewDimensions:[{id:"info-hierarchy",label:"Information Hierarchy",prompt:"What does the user see FIRST, SECOND, THIRD? Is the visual hierarchy intentional or accidental? Would a user arriving cold know what to do within 3 seconds?",evidenceRequired:!0,scope:"ui"},{id:"interaction-states",label:"Interaction State Completeness",prompt:"For every UI component in this change, verify: loading state, empty state, error state, success state, partial state. Build a matrix \u2014 mark any MISSING states.",evidenceRequired:!0,scope:"ui"},{id:"user-journey",label:"User Journey & Emotional Arc",prompt:"Walk through the user's complete journey for this feature. What's the emotional arc \u2014 curiosity \u2192 understanding \u2192 action \u2192 satisfaction? Where does it break? Where does it feel mechanical instead of crafted?",evidenceRequired:!1,scope:"ui"},{id:"accessibility",label:"Accessibility Audit",prompt:"Keyboard navigation: can every action be completed without a mouse? Focus management: is focus trapped in modals, restored after close? Contrast: WCAG 2.1 AA (4.5:1 text, 3:1 UI)? Touch targets: minimum 44x44px? Screen reader: are interactive elements labeled?",evidenceRequired:!0,scope:"ui"},{id:"design-system",label:"Design System Alignment",prompt:"Does this change use existing design tokens (colors, spacing, typography) or introduce new ones? If new \u2014 is that intentional? Check for consistency with adjacent screens.",evidenceRequired:!0,scope:"ui"},{id:"ai-slop-audit",label:"AI Slop Audit",prompt:"Run the blacklist check: purple/violet gradients? 3-column icon-grid? Everything centered? Bubbly border-radius everywhere? Decorative blobs? Emoji in headings? Colored left-border cards? Generic hero copy? Cookie-cutter section rhythm? For each pattern found, mark FAIL and describe the intentional alternative.",evidenceRequired:!0,scope:"ui"},{id:"landing-page",label:"Landing Page / Entry Point Quality",prompt:"5-second test: does a cold visitor understand what this does without reading? Skeptic test: what's the biggest objection and is it addressed above the fold? Is there social proof before the CTA? Does the headline describe the outcome, not the feature? Rate 0-10 and justify.",evidenceRequired:!1,scope:"ui"}]};var u={id:"long-lived",name:"Long-Lived",description:"Built to last. Stability, maintainability, and backward compatibility matter. Every shortcut needs justification. Favor boring technology.",category:"values",extras:[{questionId:"reversibility",text:"Will this decision still be correct in 2 years?"},{questionId:"verification",text:"Is documentation (README, CHANGELOG, API docs) up to date with this change?"},{questionId:"scope_boundary",text:"What technical debt would this introduce?"},{questionId:"status_quo",text:"What assumptions in the current architecture would this change rely on? Could any of them break?"},{questionId:"reversibility",text:"What is the rollback plan? Can you revert this change without data loss or migration? How long would reverting take?"},{questionId:"ambition",text:"Fast-forward 3 years: what would you regret about this approach? What decision is cheapest to make now vs. expensive to undo later?"},{questionId:"scope_boundary",text:"What new dependencies does this introduce? What is the maintenance burden of each? Are there lighter alternatives?"}],specSections:[{id:"migration-deprecation",title:"Migration & Deprecation",placeholder:"_If this change is a breaking change or deprecates existing behavior: what is the migration path? What version gets the breaking change? What is the deprecation timeline?_",condition:null,position:"after:acceptance-criteria"},{id:"backward-compatibility",title:"Backward Compatibility",placeholder:"_List every public-facing interface this change touches. For each: does it remain backward-compatible? If not, what is the justification and the migration guide?_",condition:null,position:"after:acceptance-criteria"},{id:"error-recovery",title:"Error Recovery",placeholder:"_For every new codepath: what can go wrong? What is the recovery action? What does the user see? Document every failure mode and its handler._",condition:null,position:"after:acceptance-criteria"},{id:"deployment-plan",title:"Deployment Plan",placeholder:"_How is this deployed? Incremental rollout? Feature flag? Can old and new code run simultaneously? What happens during partial deployment?_",condition:null,position:"after:acceptance-criteria"},{id:"runbook",title:"Runbook",placeholder:"_Operational runbook for this change: what alerts fire if it breaks, first diagnostic step, rollback command, escalation path._",condition:null,position:"after:acceptance-criteria"}],reminders:["Favor boring technology over shiny new tools","Every shortcut needs explicit justification","Consider maintenance burden for new dependencies","If this task changes public behavior, API, CLI flags, or configuration \u2014 update README and relevant docs in the SAME task. Documentation is not a follow-up.","Every new dependency is a long-term liability. Ask: could we solve this with 50 lines instead of a new package? If the package disappears tomorrow, what breaks?","Boring is good. A CRUD endpoint written in plain SQL that every engineer understands beats a clever ORM abstraction that only the author understands.","Path dependency check: does this decision foreclose future options? Lock-in is acceptable only when the trade-off is explicit and documented.","If this change has a happy path but no documented unhappy path (error recovery, partial failure, timeout), the spec is incomplete."],acceptanceCriteria:["Backward compatibility preserved","Migration path documented if breaking","No unnecessary new dependencies","Documentation updated for any public-facing change","Rollback plan exists (how to undo this change if it goes wrong)","Runbook entry added or updated for operational complexity introduced by this change","Every new dependency has: purpose documented, license checked, no known critical CVEs, alternative considered","If this change is irreversible (schema migration, external API change, data format change) \u2014 a second human has reviewed the decision"],reviewDimensions:[{id:"architecture",label:"Architecture & Coupling",prompt:"Draw the dependency graph for this change. Which modules depend on what? Are there circular dependencies? Single points of failure? Would removing one piece break the whole thing? Is the coupling direction correct (stable \u2192 volatile, not the reverse)?",evidenceRequired:!0,scope:"all"},{id:"error-rescue",label:"Error & Rescue Registry",prompt:"For every new codepath: what can go wrong? Build a table: Method/Codepath | What Can Go Wrong | Exception Class | Rescued? | Recovery Action | User Sees. Flag any row where Rescued=No or User Sees=raw error.",evidenceRequired:!0,scope:"all"},{id:"failure-modes",label:"Failure Modes Analysis",prompt:"For every new codepath: Codepath | Failure Mode | Rescued? | Tested? | User Sees | Logged? Flag CRITICAL gaps: unrescued + untested + silent failure. These block ship.",evidenceRequired:!0,scope:"all"},{id:"deployment-safety",label:"Deployment & Rollback Safety",prompt:"Can this be deployed incrementally? What happens during partial deployment (old code + new code running simultaneously)? Is rollback safe \u2014 can you revert without data loss or schema conflicts? Do you need feature flags?",evidenceRequired:!1,scope:"all"},{id:"trajectory",label:"6-Month Trajectory",prompt:"Fast-forward 6 months. What assumptions in this design might break? What would you regret? Is this creating path dependency that limits future options? What's the cost of changing course later?",evidenceRequired:!1,scope:"all"},{id:"dependency-health",label:"Dependency Health Audit",prompt:"For every new dependency introduced by this change: (1) Is it actively maintained (commits in the last 6 months)? (2) Does it have >1 maintainer? (3) Any known CVEs? (4) License compatible? (5) What's the migration cost if we need to swap it out in 2 years? Flag any single-maintainer, barely-maintained, or copyleft-licensed dependency.",evidenceRequired:!0,scope:"all"},{id:"backward-compat",label:"Backward Compatibility Audit",prompt:"List every public-facing interface touched (API endpoints, CLI flags, config keys, file formats, environment variables). For each: does this change break existing consumers? If yes \u2014 is there a migration guide? A deprecation period? Is the breaking change explicit in CHANGELOG?",evidenceRequired:!0,scope:"all"}],registries:["error-rescue","failure-modes"],dreamStatePrompt:"Synthesize: CURRENT STATE (what exists today) \u2192 THIS SPEC (what changes) \u2192 6-MONTH IDEAL (where should this be heading). What does the ideal architecture look like? Specifically: which decisions made today will still feel right in 3 years? Which ones are you accepting as necessary debt? What's the earliest signal that a debt decision is costing you \u2014 and what does the escape hatch look like?"};var p={id:"move-fast",name:"Move Fast",description:"Optimize for shipping speed. Acceptable trade-offs on polish. Good enough is good enough. Reduce ceremony.",category:"values",extras:[{questionId:"scope_boundary",text:"Which polish items can be deferred to v2?"},{questionId:"ambition",text:"What is the minimum viable 5-star version?"},{questionId:"scope_boundary",text:"If you had to cut this spec in half (by task count), what would you cut? Start there."},{questionId:"user_impact",text:"Who is the first user of this? What is the single most valuable thing they will do in the first 5 minutes? Build ONLY that."},{questionId:"reversibility",text:"What's the fastest path to validated feedback? Shipped is more valuable than perfect."}],specSections:[{id:"v1-vs-v2-scope",title:"v1 vs v2 Scope",placeholder:"_Explicitly separate what ships in v1 from what is deferred to v2. For every task, answer: does the first user need this on day 1? If no, it is v2._",condition:null,position:"after:scope-boundary"},{id:"deferred-items",title:"Deferred Items",placeholder:"_List every item cut from v1. For each: what it is, why it was deferred, and what user need it would address in a future iteration._",condition:null,position:"after:scope-boundary"}],reminders:["Good enough is good enough \u2014 ship it","Reduce ceremony, optimize for feedback speed","Mark polish items for v2 explicitly","BOILING THE LAKE anti-pattern: over-engineering the 'minimal' v1 is still over-engineering. If the spec has more than 5 tasks, challenge each one: 'What breaks for the first user if we defer this?' If nothing breaks, it's v2.","SCOPE REDUCTION mode: if spec tasks exceed 5, enter scope reduction. For each task, ask: (a) Does the first user need this on day 1? (b) Can we ship without this and add it in the next iteration? (c) Are we building this because it's needed or because it feels complete? Defer anything that answers 'no' to (a) or 'yes' to (b).","Scope creep is invisible \u2014 it feels like thoroughness. Challenge every task added after the initial spec: 'What user problem does this solve that wasn't already solved?'","The right question is not 'is this good enough?' but 'is this good enough to learn from?' Ship to learn, not to be done.","Feedback is worth more than polish. A shipped rough version generates 10x more useful information than a polished version that never reaches users."],acceptanceCriteria:["Core functionality works","v2 items explicitly deferred","Spec contains an explicit 'Deferred to v2' list \u2014 items that were cut and why","No task in the spec is optional for the first user's core use case"],reviewDimensions:[{id:"scope-knife",label:"Scope Knife",prompt:"For every task in this spec: is it v1-essential or v2-deferrable? Apply the rule: if removing this task still leaves a usable feature, it's v2. Be aggressive \u2014 list everything you'd cut and what remains.",evidenceRequired:!1,scope:"all"},{id:"lake-check",label:"Boil-the-Lake Check",prompt:"Look at the spec holistically: is any task secretly v2 dressed as v1? Signs of lake-boiling: tasks about 'polish', 'cleanup', 'refactor', 'generalization', 'extensibility', 'configurability' in a first-version spec. List each flagged task and what it would take to defer it.",evidenceRequired:!1,scope:"all"},{id:"feedback-loop",label:"Feedback Loop Speed",prompt:"How quickly can real user feedback be obtained after shipping this? What's the measurement plan \u2014 how will you know if this worked? Is there a shorter path to the same learning? Could a prototype, feature flag, or smaller release validate the hypothesis faster?",evidenceRequired:!1,scope:"all"}]};var m={id:"compliance",name:"Compliance",description:"Audit trails, access controls, data handling rules. Every change is traceable. Verification is mandatory, not optional.",category:"engineering",extras:[{questionId:"reversibility",text:"Is the audit trail preserved on rollback?"},{questionId:"verification",text:"Is there an audit/traceability requirement?"},{questionId:"scope_boundary",text:"Which data handling regulations apply to this change (GDPR, CCPA, HIPAA, PCI-DSS, SOC 2)? What specific requirements do they impose on this feature?"},{questionId:"user_impact",text:"Does this change handle PII (names, emails, IPs, device IDs, location)? If yes, is there a data minimization plan \u2014 only collect what's needed, only retain as long as needed?"},{questionId:"ambition",text:"What does 'fully auditable' mean for this feature? Can a compliance officer reconstruct every action taken by every user on any given day?"}],specSections:[{id:"audit-trail",title:"Audit Trail",placeholder:"_For every state mutation in this change: what is logged? Who, what, when, from-value, to-value? Can a compliance officer reconstruct the full history of any record from the audit log?_",condition:null,position:"after:acceptance-criteria"},{id:"access-control",title:"Access Control",placeholder:"_For every new endpoint, action, or resource: what is the authorization check? Is it deny-by-default? Can user A access user B's data? Document each authorization rule._",condition:null,position:"after:acceptance-criteria"},{id:"data-handling",title:"Data Handling",placeholder:"_What data does this feature create, read, update, or delete? What PII is involved? How is it stored, encrypted, and protected? Which regulations apply (GDPR, CCPA, HIPAA)?_",condition:null,position:"after:acceptance-criteria"},{id:"retention-policy",title:"Retention Policy",placeholder:"_What is the retention policy for every new data element? How long is it kept? Who can request deletion? What is the deletion mechanism?_",condition:null,position:"after:acceptance-criteria"}],reminders:["Every state change must be traceable","Verification is mandatory, not optional","Document data handling and retention policies","OWASP Top 10 (always check): A01 Broken Access Control, A02 Cryptographic Failures, A03 Injection (SQL/XSS/command), A04 Insecure Design, A05 Security Misconfiguration, A06 Vulnerable Components, A07 Auth Failures, A08 Software Integrity Failures, A09 Logging Failures, A10 SSRF. For any compliance-tagged change, explicitly verify that A01 (authz) and A03 (injection) are addressed.","PII is toxic \u2014 minimize it. Never store more than you need, never longer than required. If you don't need the IP address, don't log it. If you don't need the full name, store initials.","Deny by default: every new endpoint, every new data access path starts with no permissions granted. Authorization is opt-in, not opt-out.","Encryption at rest AND in transit for any field classified as PII or sensitive. 'We'll add it later' is not acceptable for compliance data."],acceptanceCriteria:["Audit trail added for state changes","Access control verified","Data handling documented","Retention policy defined for any new data stored","PII fields identified, documented, and encrypted at rest","Every new access path has explicit authorization \u2014 no 'assume authenticated = authorized'","OWASP A01 (access control) and A03 (injection) explicitly checked and documented"],reviewDimensions:[{id:"audit-completeness",label:"Audit Trail Completeness",prompt:"For every state mutation in this change: is it logged? Who, what, when, from-value, to-value? Can you reconstruct the full history of any record from the audit log alone?",evidenceRequired:!0,scope:"data"},{id:"data-lifecycle",label:"Data Lifecycle & Retention",prompt:"What data does this feature create, read, update, delete? What's the retention policy? Can a user request deletion (GDPR)? Is PII identified and handled correctly?",evidenceRequired:!0,scope:"data"},{id:"access-control",label:"Access Control (OWASP A01)",prompt:"For every endpoint, data access, and action in this change: what's the authorization check? Is it deny-by-default? Can a user elevate their own privileges? Can user A access user B's data by guessing an ID? Is authorization checked at the data layer (not just the UI layer)?",evidenceRequired:!0,scope:"api"},{id:"injection-surface",label:"Injection Surface (OWASP A03)",prompt:"For every user-controlled input that flows into a database query, OS command, template engine, or HTML context: is it parameterized/escaped? Check for SQL injection, XSS, command injection, template injection, and path traversal. Enumerate every input \u2192 sink path.",evidenceRequired:!0,scope:"api"},{id:"data-minimization",label:"PII Minimization",prompt:"List every piece of PII this change collects, stores, or processes: names, emails, IPs, device IDs, location, behavioral data. For each: is it necessary? Could the feature work with less? Is it encrypted at rest? Is it excluded from logs? Does it have a deletion path?",evidenceRequired:!0,scope:"data"}],suggestsPosture:"hold-scope"};var f={id:"learning-project",name:"Learning Project",description:"Experimentation is the goal. Encourage trying new patterns, don't punish dead ends. Document learnings over polish.",category:"values",extras:[{questionId:"ambition",text:"What do you want to learn from building this?"},{questionId:"scope_boundary",text:"What experiments are explicitly allowed?"},{questionId:"ambition",text:"What's the specific hypothesis you're testing? Phrase it as a falsifiable statement: 'I believe that X, because Y. I'll know I'm right when Z.' How will you know if the experiment succeeded or failed?"},{questionId:"status_quo",text:"What do you already know about this problem from past projects? What's the specific gap that this experiment fills?"},{questionId:"user_impact",text:"What would be the most SURPRISING outcome? What would change your mental model completely?"}],specSections:[{id:"learning-goals",title:"Learning Goals",placeholder:"_What specific questions will this experiment answer? What knowledge gap does it fill? How will you know if the experiment succeeded or failed?_",condition:null,position:"after:ambition"},{id:"hypothesis",title:"Hypothesis",placeholder:"_State a falsifiable hypothesis: 'I believe X because Y. I will know I am right when Z.' If the experiment is complete, state the verdict: confirmed, rejected, or inconclusive._",condition:null,position:"after:ambition"},{id:"experiment-log",title:"Experiment Log",placeholder:"_Document what was tried, in what order, and what each attempt produced. Include dead ends \u2014 they are data. Tag mental model shifts with EUREKA:_",condition:null,position:"after:acceptance-criteria"}],reminders:["Document learnings, not just outcomes","Dead ends are acceptable \u2014 document why","Try new patterns freely, polish later","EUREKA MOMENT: when your mental model shifts \u2014 when you realize something is fundamentally different than you assumed \u2014 tag it explicitly: 'EUREKA: [what changed]'. These are the most valuable learnings. Capture them in real time.","Cross-spec learning: before starting, review learnings from similar past specs using `noskills spec list` and `noskills learn search`. Build on what you already know.","Learning velocity matters: if you're 3 iterations in and the hypothesis is still unclear, stop and restate it. Confusion is data \u2014 it means the experiment design is wrong.","Negative results are results. A failed experiment with clear documentation is more valuable than a successful experiment with no documentation.","The learning is worth more than the code. If you have to choose between a clean implementation and a documented learning, document the learning."],acceptanceCriteria:["Learnings documented","Experiment outcomes recorded","At least one learning captured with `noskills spec learn` (one-time) or `noskills learn --rule` (permanent)","Eureka moments tagged separately with 'EUREKA:' prefix in the learning","Hypothesis explicitly stated at the start and evaluated at the end: confirmed, rejected, or inconclusive","Dead ends documented: why each failed approach was tried and why it was abandoned"],reviewDimensions:[{id:"learning-clarity",label:"Learning Goal Clarity",prompt:"For each learning goal: what specific question will be answered? How will you know if the experiment succeeded or failed? What's the 'good enough to learn from' threshold?",evidenceRequired:!1,scope:"all"},{id:"hypothesis-validity",label:"Hypothesis Evaluation",prompt:"Was the hypothesis stated at the start? Was it falsifiable (a clear yes/no outcome)? What was the actual outcome \u2014 confirmed, rejected, or inconclusive? If inconclusive: why? What would make it decidable? Were there confounding variables?",evidenceRequired:!1,scope:"all"},{id:"eureka-capture",label:"Eureka Moment Capture",prompt:"What changed in your mental model during this experiment? What did you believe at the start that turned out to be wrong? What surprised you most? Rate the learning density: 0 = built something, learned nothing | 5 = validated a known hypothesis | 10 = mental model completely revised. If score is below 5, why?",evidenceRequired:!1,scope:"all"},{id:"knowledge-transfer",label:"Knowledge Transfer",prompt:"Are the learnings written for your future self \u2014 6 months from now, context forgotten? Are there code comments that explain WHY a choice was made, not just WHAT? Would a new team member reading the experiment log understand what was tried, why, and what was learned?",evidenceRequired:!1,scope:"all"}]};var g={id:"well-engineered",name:"Well-Engineered",description:"Engineering craftsmanship. Performance is measured, not assumed. Tests are strategic, not ceremonial. Errors are helpful, not cryptic. Security is a design constraint, not a checklist. Observability is built-in, not bolted on. The system is debuggable by someone who didn't write it.",category:"engineering",extras:[{questionId:"verification",text:"What's the test strategy? Which layer (unit/integration/e2e) covers which behavior? What's explicitly NOT worth testing?"},{questionId:"status_quo",text:"Are there known performance bottlenecks, missing logs, security concerns, or confusing error messages in the area you're changing?"},{questionId:"ambition",text:"If a developer encounters an error from this code at 3am \u2014 will the error message tell them the problem, the cause, and the fix?"},{questionId:"scope_boundary",text:"Does this change introduce new inputs, new trust boundaries, or new attack surface? What's the threat model?"},{questionId:"user_impact",text:"What's the Time-To-Hello-World for a developer using this for the first time? How many steps from install to first success?"}],specSections:[{id:"test-strategy",title:"Test Strategy",placeholder:"_Map every new behavior to a test layer: Unit (pure logic), Integration (boundaries, real deps), E2E (critical user flows). Name the specific test files. List explicitly what is NOT worth testing._",condition:null,position:"after:verification-strategy"},{id:"performance-considerations",title:"Performance Considerations",placeholder:"_For every new codepath: time complexity, any N+1 queries, missing indexes, unbounded memory growth. Measure, do not guess. Include benchmark numbers where applicable._",condition:null,position:"after:verification-strategy"},{id:"observability-plan",title:"Observability Plan",placeholder:"_For every new codepath: structured logging at entry/exit, latency metrics, trace ID propagation, alert tiers. If a page is not in a dashboard, it does not exist in production._",condition:null,position:"after:verification-strategy"},{id:"error-handling",title:"Error Handling",placeholder:"_For every error path: what does the error message contain (problem, cause, remediation)? Is it logged with enough context to debug at 3am without reading source code?_",condition:null,position:"after:verification-strategy"},{id:"security-threat-model",title:"Security & Threat Model",placeholder:"_What are the trust boundaries? Where does untrusted input enter? What could an attacker do \u2014 injection, privilege escalation, data exfiltration, DoS? For every new endpoint: who can access it?_",condition:null,position:"after:verification-strategy"},{id:"developer-ergonomics",title:"Developer Ergonomics",placeholder:"_After this change: does `git clone && install && run` still work without manual steps? Any new env vars or services? What is the Time-To-Hello-World for a new developer?_",condition:null,position:"after:verification-strategy"}],conductRules:{DISCOVERY:["For every change touching shared state, ask about failure modes and recovery paths explicitly.","For every async operation, ask about timeouts, cancellation, and partial-failure semantics."]},reminders:["Every error message should contain: what went wrong, why, and what to do about it. 'Something went wrong' is never acceptable.","Test at the right level: unit for logic, integration for boundaries, e2e for critical paths. More tests is better than fewer \u2014 but pointless tests are noise.","Performance claims need evidence: run the benchmark, check the query plan, measure the memory. 'Should be fast' is not engineering.","Every new codepath must be observable: structured log at entry/exit, metric for latency, trace ID for correlation. If you can't see it in production, it doesn't exist.","Escape hatches: every opinionated default should be overridable via config, env var, or parameter. Don't trap users.","Every user input is hostile until validated. Validate at system boundaries, not deep inside business logic.","Never log secrets, tokens, passwords, or PII. Check log output for accidental exposure.","New endpoints need auth/authz. Default to deny.","Progressive disclosure: simple things simple, complex things possible. Don't front-load complexity.","REGRESSION IRON LAW: NEVER fix a bug without first writing a failing test that reproduces it. Red \u2192 Green \u2192 Refactor. No exceptions. A fix without a reproduction test will recur.","Make the change easy, then make the easy change (Beck). Separate refactoring PRs from feature PRs. Never refactor and feature in the same commit.","Confidence calibration: when making a claim ('this is secure', 'this is fast', 'this handles edge cases'), provide a 1-10 confidence score with explicit basis: '7/10 because X is tested but Y is not verified under load'. Overconfidence is a bug.","TEST FRAMEWORK DETECTION: before writing tests, check what framework is already in use (Deno/Jest/pytest/Go test/etc.). Don't introduce a second test runner. Match the existing style (describe/it vs. Test/t.Run vs. def test_).","Engineering cognitive patterns \u2014 check before every significant decision: (1) Minimal viable diff: achieve the goal with the fewest changes. (2) Boring is good: prefer stable, understood tech over novel. (3) Explicit over implicit: name your assumptions. (4) System over heroes: the code should be understandable without knowing the author. (5) Essential vs. accidental complexity: eliminate complexity that doesn't come from the problem itself."],acceptanceCriteria:["Test strategy covers happy path AND failure paths at appropriate layers","No N+1 queries or obvious performance regressions (evidence required)","New codepaths have structured logging with trace correlation","Error messages include problem, cause, and remediation","All user inputs validated at system boundaries","No hardcoded secrets or credentials in code","New endpoints have explicit auth/authz","Getting started path works end-to-end without undocumented steps","Every bug fix includes a regression test that was failing before the fix and passing after (Regression Iron Law)"],reviewDimensions:[{id:"test-strategy",label:"Test Pyramid Strategy",prompt:"Map every new behavior to a test layer: Unit (pure logic, fast, isolated) | Integration (boundaries, I/O, real deps) | E2E (critical user flows). Flag: untested failure paths, tests that test framework instead of behavior, missing edge cases. Too many tests > too few.",evidenceRequired:!0,scope:"all"},{id:"performance",label:"Performance Analysis",prompt:"For every new codepath: What's the time complexity? Any N+1 queries? Missing database indexes? Unbounded memory growth? Unnecessary serialization? Are there hot paths that need caching? Measure, don't guess.",evidenceRequired:!0,scope:"all"},{id:"observability",label:"Observability & Debuggability",prompt:"For every new codepath: Is there structured logging at entry and exit? Metrics for latency and error rate? Trace ID propagation? If this breaks at 3am, can oncall diagnose it from dashboards and logs without reading source code? What alerts should fire?",evidenceRequired:!0,scope:"all"},{id:"error-quality",label:"Error Message Quality",prompt:"Find every error message, exception, and user-facing failure in this change. For each: does it state the PROBLEM (what happened), CAUSE (why), and FIX (what to do)? Does it include enough context to debug (IDs, paths, values)? Would a user or developer at 3am understand it without reading source code?",evidenceRequired:!0,scope:"all"},{id:"threat-model",label:"Threat Model & Security",prompt:"What are the trust boundaries in this change? Where does untrusted input enter? What could an attacker do \u2014 injection (SQL, XSS, command), privilege escalation, data exfiltration, denial of service? For every new endpoint: who can access it? Is authorization checked at the right layer (not just UI)?",evidenceRequired:!0,scope:"all"},{id:"input-validation",label:"Input Validation Audit",prompt:"Find every point where external data enters the system (HTTP params, file uploads, env vars, webhook payloads, user-controlled DB fields). For each: what validation exists? Maximum size/length? Types enforced? Sanitized before rendering (XSS) or query construction (injection)?",evidenceRequired:!0,scope:"all"},{id:"secrets-lifecycle",label:"Secrets & Credentials",prompt:"What secrets does this change use or introduce (API keys, tokens, passwords, encryption keys)? Where stored? How rotated? Ever logged, serialized to JSON, or included in error messages? Dependencies: any new ones with known CVEs?",evidenceRequired:!0,scope:"all"},{id:"escape-hatches",label:"Escape Hatches & Overridability",prompt:"List every opinionated default introduced by this change (timeouts, limits, formats, behaviors). For each: can the user override it? Via config, env var, or parameter? If not \u2014 should they be able to? Every opinion needs an escape hatch.",evidenceRequired:!0,scope:"all"},{id:"dev-friction",label:"Developer Environment & Onboarding",prompt:"After this change: does `git clone && install && run` still work without manual steps? Any new env vars, services, or tools required? What's the Time-To-Hello-World? Is the dev setup documented? Would a new team member be blocked?",evidenceRequired:!1,scope:"all"},{id:"api-ergonomics",label:"API/CLI Ergonomics",prompt:"Review every public API method, CLI command, and config option touched by this change. Names self-explanatory? Defaults sensible? Progressive disclosure working (simple things simple, complex things possible)? Breaking changes have migration guide with before/after?",evidenceRequired:!0,scope:"api"},{id:"regression-coverage",label:"Regression Coverage",prompt:"For every bug fix in this change: is there a test that was RED before the fix and GREEN after? For every behavior change: is there a test that pins the new behavior? If a future refactor silently breaks this, which test will catch it? Name the specific test files and test names.",evidenceRequired:!0,scope:"all"},{id:"confidence-calibration",label:"Confidence Calibration",prompt:"Rate your overall confidence in the correctness of this change: 1-10. For each major claim made in the implementation ('this handles concurrency', 'this is secure', 'this performs within SLA'): what's your specific confidence score (1-10) and what's the basis? What would it take to raise a 6 to a 9? What's unverified?",evidenceRequired:!1,scope:"all"}],registries:["test-plan"]};var y={id:"developer-experience",name:"Developer Experience",description:"APIs and CLIs are products. Time-To-Hello-World is the north star metric. Friction at any step is a bug. Progressive disclosure, sensible defaults, and honest error messages are non-negotiable.",category:"engineering",extras:[{questionId:"user_impact",text:"What is the Time-To-Hello-World (TTHW) for a developer using this for the first time? How many steps from install to first success? Set a target: <5 minutes for simple APIs, <15 minutes for complex ones."},{questionId:"ambition",text:"What does 'zero friction' look like for this API/CLI? What would you cut if you could only ship the thing that delivers value in one command?"},{questionId:"verification",text:"How will you measure TTHW? Will you do a fresh-install walkthrough before marking done? Name the specific steps."},{questionId:"status_quo",text:"What is the current TTHW? Where do developers get stuck today? Name the top 3 friction points."}],specSections:[{id:"developer-onboarding",title:"Developer Onboarding",placeholder:"_Walk through the developer journey: install \u2192 first run \u2192 first success. List every step. Set a TTHW target (<5 min for simple APIs, <15 min for complex ones). Document every friction point._",condition:null,position:"after:user-impact"},{id:"api-ergonomics",title:"API Ergonomics",placeholder:"_Review every public function, method, parameter, flag, and config key. Are names self-explanatory without docs? Breaking changes have before/after migration examples?_",condition:null,position:"after:user-impact"},{id:"tthw-benchmark",title:"TTHW Benchmark",placeholder:"_Count the exact number of steps from `git clone` to first successful output. Score: 1-3 steps = excellent, 4-6 = acceptable, 7+ = problematic. List every step and flag any that require reading docs._",condition:null,position:"after:user-impact"}],reminders:["DX Principle 1: Every breaking change must have a migration guide. Before/after code examples required.","DX Principle 2: Simple things simple, complex things possible. Progressive disclosure \u2014 the first example should be 3 lines, not 30.","DX Principle 3: Honest errors. When a developer does something wrong, the error message must tell them what to do \u2014 not what the system did internally.","DX Principle 4: Golden path first. The most common use case should work with the fewest steps. Optimize for that path.","DX Principle 5: Defaults should be production-ready, not just convenient. A developer who never reads docs should still end up with a secure, correct configuration.","DX Principle 6: Don't add friction to the happy path to handle edge cases. Edge cases get docs, not required configuration.","DX Principle 7: Every new config option must justify its existence. Configuration is debt. Ask: can we make this automatic?","Boomerang test: send a developer away with your API and ask them to complete a task without help. If they get stuck, that's a bug \u2014 not a documentation gap."],acceptanceCriteria:["TTHW documented: how many steps from install to first success, with a target of <5 min for simple APIs","Fresh-install walkthrough completed: clone \u2192 install \u2192 run \u2192 first success without undocumented steps","Every new config option has a sensible default \u2014 no required configuration for the happy path","Every error message tells the developer what to do, not just what went wrong","Breaking changes have before/after migration examples","All public API names are self-explanatory \u2014 no abbreviations, no internal jargon"],reviewDimensions:[{id:"tthw-measurement",label:"Time-To-Hello-World",prompt:"Count the exact number of steps from `git clone` to first successful output. Include: installs, config, environment variables, auth setup, first API call or CLI run. Score: 1-3 steps = excellent, 4-6 = acceptable, 7+ = problematic. List every step and flag any that require reading docs or guessing.",evidenceRequired:!0,scope:"api"},{id:"progressive-disclosure",label:"Progressive Disclosure",prompt:"Can a developer do the simplest thing in 3 lines of code? Does complexity only appear when needed? Review the README, getting started guide, and API docs: is the first example minimal? Is advanced configuration buried appropriately, not front-loaded? Score the progressive disclosure quality 0-10.",evidenceRequired:!0,scope:"api"},{id:"error-messages-dx",label:"Error Message Quality (DX)",prompt:"Find every error a developer might encounter during setup or first use. For each: does it say what went wrong, why, AND what to do? Does it point to the right docs section? Can a developer fix the issue without leaving their terminal? Flag any error that says 'invalid' without saying what valid looks like.",evidenceRequired:!0,scope:"api"},{id:"api-naming",label:"API Naming & Ergonomics",prompt:"Review every public function, method, parameter, flag, and config key. Are names self-explanatory without docs? Are boolean parameters avoided in favor of named enums? Are similar operations named consistently? Would a developer using a competing tool find the API intuitive?",evidenceRequired:!0,scope:"api"},{id:"breaking-change-migration",label:"Breaking Change Migration Path",prompt:"List every breaking change in this diff: renamed functions, changed parameter types, removed options, changed defaults, modified CLI flags. For each: is there a migration guide with before/after code examples? Is the change announced in CHANGELOG with the version? Is there a deprecation period?",evidenceRequired:!0,scope:"api"},{id:"dx-defaults",label:"Default Configuration Safety",prompt:"For every default value introduced or changed: what does a developer get if they never read the docs? Is the default secure? Is it production-appropriate? Is it consistent with community conventions for this language/framework? List each default and rate it: safe/acceptable/risky.",evidenceRequired:!1,scope:"api"}]};var v={id:"root-cause",name:"Root Cause Investigation",description:"NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST. Symptoms are not bugs. The bug is the condition that allowed the symptom to occur. A fix that addresses the symptom without finding the root cause will recur \u2014 guaranteed. Every bugfix must trace the failure to its origin and verify the chain.",category:"quality",extras:[{questionId:"status_quo",text:"What is the exact symptom? What is the FIRST place in the call stack / data flow where the value is wrong \u2014 not where it surfaces, where it originates?"},{questionId:"ambition",text:"What condition allowed this bug to exist undetected? What would need to be true about the system for this bug to be IMPOSSIBLE \u2014 not just fixed?"},{questionId:"verification",text:"How will you reproduce this bug in a test BEFORE writing any fix? Name the exact test file and test case."},{questionId:"scope_boundary",text:"Is this a symptom of a deeper pattern? Check: has this or a similar bug appeared before? Are there related code paths that have the same vulnerability?"}],specSections:[{id:"symptom-description",title:"Symptom Description",placeholder:"_What is the exact symptom? Reproduce it step by step. What is the expected behavior vs. actual behavior? Which users are affected, and under what conditions?_",condition:null,position:"after:problem-statement"},{id:"root-cause-analysis",title:"Root Cause Analysis",placeholder:"_Trace the failure to its origin: what is the FIRST place in the call stack or data flow where the value is wrong \u2014 not where it surfaces, where it originates. File:line reference required._",condition:null,position:"after:problem-statement"},{id:"reproduction-test",title:"Reproduction Test",placeholder:"_Name the exact test file and test case that reproduces this bug. Confirm it was RED before the fix and GREEN after. The test must target the root cause condition, not just the symptom._",condition:null,position:"after:problem-statement"},{id:"fix-strategy",title:"Fix Strategy",placeholder:"_Describe the fix at the root cause level. Why does this fix make the class of bug impossible, not just this instance? What other codepaths have the same vulnerability?_",condition:null,position:"after:problem-statement"},{id:"bug-verification",title:"Verification",placeholder:"_How is the fix verified? Regression test name, manual reproduction steps, and any monitoring signals that confirm the fix is effective in production._",condition:null,position:"after:problem-statement"}],reminders:["IRON LAW: NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST. Before writing one line of fix code, you must identify the root cause. 'I think it's X' is not a root cause. The root cause is the deepest causal condition in the system that, if changed, would make this class of bug impossible.","5-Phase Structure \u2014 follow this order: (1) INVESTIGATE: reproduce the bug, map the call chain, identify where the wrong value originates. (2) PATTERN ANALYSIS: is this a one-off or a class of bugs? Check for similar patterns nearby. (3) HYPOTHESIS TESTING: state a falsifiable hypothesis about the root cause, test it. (4) IMPLEMENTATION: write the fix at the root, not the symptom. (5) VERIFICATION: run the reproduction test \u2014 it must go from RED to GREEN.","3-Strike Rule: if your first hypothesis is wrong, revise. If your second is wrong, stop and map the full data flow from entry to failure. Three strikes = STOP, write down everything you know, ask for help. Do NOT keep guessing.","Fault taxonomy \u2014 check each: (1) Off-by-one: boundary condition wrong. (2) Race condition: shared state, missing lock, wrong order. (3) Nil/null propagation: unwrap of optional without check. (4) Type coercion: implicit conversion producing wrong type. (5) Stale closure/reference: captured value from wrong scope/time. (6) Missing case: enum or union with an unhandled branch.","Scope-lock: once you find the root cause, do NOT expand scope. Fix the root cause. If you notice related issues, document them as follow-up tasks. A bugfix PR that adds features or refactors adjacent code is a scope violation.","Regression test is not optional: write the failing test FIRST (RED), then write the fix (GREEN), then verify no other tests broke. The test must specifically target the root cause condition \u2014 not just exercise the code path.","Every bug is a system failure: ask 'why did the system allow this?' \u2014 missing validation, missing test coverage, wrong abstraction, design mismatch. The fix address the root; the retrospective addresses the system."],acceptanceCriteria:["Root cause identified and documented: the exact condition that allowed the bug to exist, with file:line reference","Reproduction test written BEFORE the fix \u2014 test was RED before fix, GREEN after (Regression Iron Law)","Fix addresses the root cause, not the symptom \u2014 symptom disappears as a consequence","Pattern check completed: adjacent code paths with same vulnerability identified and either fixed or documented as follow-up","3-Strike Rule applied: if hypothesis changed, documented why each failed hypothesis was wrong","No scope expansion: fix PR contains only the root cause fix and its test \u2014 no adjacent refactors"],reviewDimensions:[{id:"root-cause-depth",label:"Root Cause Depth",prompt:"What is the deepest causal condition identified? Does the fix change the condition that ALLOWED the bug, or does it paper over the symptom? Test: if the fix were removed, would the bug recur? If yes, the fix is at the symptom level. Trace the call chain from symptom to origin \u2014 name the file and line where the wrong value is introduced.",evidenceRequired:!0,scope:"all"},{id:"reproduction-test",label:"Reproduction Test (Red-Green Verification)",prompt:"Name the specific test that reproduces the bug. Confirm it was written BEFORE the fix and was RED before the fix. Confirm it is GREEN after the fix. Is the test testing the ROOT CAUSE condition, or is it testing the symptom? If the root cause is removed, will this test catch a regression?",evidenceRequired:!0,scope:"all"},{id:"pattern-sweep",label:"Pattern Analysis",prompt:"Is this bug an instance of a class? Check: are there other code paths with the same vulnerability (same type coercion, same nil propagation, same boundary condition)? Name any you found. If this bug has appeared before, how was it fixed last time \u2014 and why did that fix not prevent this recurrence?",evidenceRequired:!1,scope:"all"}],lifecycle:{appliesToKinds:["bugfix"]}};var w={id:"qa-tested",name:"QA Tested",description:"Adversarial QA is not 'clicking around'. It is systematic exploration with the mindset of a user who doesn't know how the system works and is trying to break it. Happy path only is not QA. Every input boundary, every empty state, every error path must be verified. Ship nothing that hasn't been QA'd.",category:"quality",extras:[{questionId:"verification",text:"What is the QA plan? List the specific flows a tester must exercise \u2014 including failure paths, empty states, and edge inputs. Who will do the QA before marking done?"},{questionId:"user_impact",text:"What is the worst thing a user could do with this feature that would break it? Have you tested that exact path?"},{questionId:"status_quo",text:"What bugs would a fresh-eyes tester find today? Name the top 3 things most likely to be broken in the current implementation."}],specSections:[{id:"qa-plan",title:"QA Plan",placeholder:"_List the specific flows a tester must exercise \u2014 including failure paths, empty states, and edge inputs. Who does the QA? What is the acceptance threshold (no CRITICAL or HIGH issues)?_",condition:null,position:"after:verification-strategy"},{id:"test-coverage",title:"Test Coverage",placeholder:"_Map every new behavior to its test: file name, test case name, what behavior it pins. Include both happy path and failure path coverage. What is explicitly not tested and why?_",condition:null,position:"after:verification-strategy"},{id:"known-edge-cases",title:"Known Edge Cases",placeholder:"_List every edge case that must be tested: empty input, very long input, special characters, zero/negative numbers, missing auth, concurrent access, network failure mid-action._",condition:null,position:"after:verification-strategy"}],reminders:["QA mindset: you are not testing that the happy path works. You are trying to BREAK the system. Find the input that causes the wrong output, the state that causes the wrong render, the error that shows the wrong message.","Health Score Rubric \u2014 each category must score above threshold before ship: Console errors (0 = clean, -15 per JS error, -10 per warning), Broken links (0 = clean, -10 per 404), Form validation (-10 per unhandled invalid input), Empty states (-5 per missing), Error handling (-10 per unhandled error path), Cross-browser (-5 per layout break).","6-Phase QA Structure: (1) INITIALIZE \u2014 load the feature fresh, no prior state. (2) AUTHENTICATE \u2014 verify auth works AND fails correctly. (3) ORIENT \u2014 does the UI match the spec? Check labels, order, colors, states. (4) EXPLORE \u2014 exercise every input, every button, every state transition. (5) DOCUMENT \u2014 record every deviation from expected. (6) WRAP UP \u2014 rate severity per issue, block ship on CRITICAL and HIGH.","Diff-aware mode: QA must focus on the diff, not the whole product. For every file changed, ask: what behavior changed? Test that behavior specifically \u2014 including the behavior before the change to catch regressions.","Severity classification: CRITICAL = data loss or security issue (blocks ship). HIGH = broken core flow (blocks ship). MEDIUM = degraded experience (should fix before ship, can defer if documented). LOW = polish issue (document, ship anyway).","Adversarial inputs: test with empty strings, null/undefined, very long inputs, special characters (especially `<script>`, `'`, `\"`, `\n`, emoji), negative numbers, zero, numbers at MAX_SAFE_INTEGER, past and future dates, wrong file types."],acceptanceCriteria:["QA plan documented: specific flows, edge cases, and adversarial inputs listed before QA begins","Happy path verified: the primary user flow works end-to-end without errors","Error paths verified: every error state shows a helpful message (not a blank screen or stack trace)","Empty states verified: every list, table, and container has a meaningful empty state","Boundary inputs tested: empty, very long, special characters, invalid types \u2014 all handled","No CRITICAL or HIGH severity issues open at ship time","Health score passes threshold: no JS console errors, no broken links on changed pages"],reviewDimensions:[{id:"happy-path-coverage",label:"Happy Path Coverage",prompt:"Walk through the primary user flow end-to-end. Does it work? Does every step produce the expected output? Is the completion state correct? Name each step and its actual vs expected output.",evidenceRequired:!0,scope:"all"},{id:"adversarial-inputs",label:"Adversarial Input Testing",prompt:"What inputs were tested beyond the happy path? For each form field, API parameter, or user-controlled value: was empty input tested? Very long input? Special characters (`<script>`, SQL quotes, emoji)? Numbers at boundaries (0, negative, MAX_SAFE_INTEGER)? Name the inputs tested and the results.",evidenceRequired:!0,scope:"all"},{id:"error-state-coverage",label:"Error State & Empty State Coverage",prompt:"For every error path in the diff: does the UI show a meaningful error message (not a blank screen, not a stack trace, not 'something went wrong')? For every list or data-dependent component: what does it show when empty? Is the empty state meaningful and actionable?",evidenceRequired:!0,scope:"ui"},{id:"health-score",label:"QA Health Score",prompt:"Run the Health Score Rubric. Console: any JS errors or warnings on the changed pages? Links: any 404s? Forms: any unhandled invalid inputs? Empty states: any missing? Error handling: any unhandled paths? Cross-browser: any layout breaks? Score each category. Report total health score and flag any category below threshold.",evidenceRequired:!0,scope:"ui"}]};var b={id:"security-audited",name:"Security Audited",description:"Security is a design constraint, not a post-ship checklist. Every trust boundary, every user-controlled input, every secret, every endpoint is a potential attack surface. The job is to enumerate the attack surface completely, then verify each vector. OWASP Top 10 is the minimum bar, not the ceiling.",category:"quality",extras:[{questionId:"scope_boundary",text:"What new trust boundaries does this change introduce? Where does untrusted input enter the system? What can an external caller control, and what can they do with that control?"},{questionId:"verification",text:"Which OWASP Top 10 categories apply to this change? For each applicable category, what specific test verifies this change does not introduce a vulnerability?"},{questionId:"status_quo",text:"What secrets does this change use, create, or expose? Where are they stored? When were they last rotated? Are they ever logged, serialized, or included in error messages?"},{questionId:"ambition",text:"If an attacker had 30 minutes with this feature, what would they try first? What is the highest-value target? Have you tested that path?"}],specSections:[{id:"trust-boundary-model",title:"Trust Boundary Model",placeholder:"_Map all trust zones, entry points, and data flows. What components are involved? Where does untrusted input enter? Sketch the architecture before opening the code._",condition:null,position:"after:scope-boundary"},{id:"attack-surface-census",title:"Attack Surface Census",placeholder:"_Enumerate every external input: HTTP params, headers, cookies, file uploads, env vars, webhook payloads, OAuth callbacks, CLI args. For each: what validation is applied?_",condition:null,position:"after:scope-boundary"},{id:"owasp-top10-checklist",title:"OWASP Top 10 Checklist",placeholder:"_For each applicable OWASP category (A01\u2013A10), state: does this change touch it? What specific test verifies this change does not introduce a vulnerability? File:line reference per check._",condition:null,position:"after:scope-boundary"},{id:"secrets-lifecycle",title:"Secrets Lifecycle",placeholder:"_Find every secret (API key, token, password, signing key). For each: where stored, how rotated, ever in logs/error messages/serialized responses? Any hardcoded? Last rotation date?_",condition:null,position:"after:scope-boundary"},{id:"dependency-supply-chain",title:"Dependency Supply Chain",placeholder:"_For every new dependency: CVE check (npm audit / go vuln / pip-audit), maintainer verification, download count, license compatibility. No new dependency without evidence of review._",condition:null,position:"after:scope-boundary"}],conductRules:{DISCOVERY:["Ask which OWASP Top 10 categories the change touches \u2014 enumerate them, do not assume none apply.","For any new endpoint, ask about authentication, authorization, rate limiting, and input validation \u2014 all four, separately."]},reminders:["Phase 0 \u2014 Architecture Mental Model FIRST: before reviewing any specific vulnerability, build a complete mental model of the system: what data flows in, through, and out? What components are involved? What are the trust zones? Sketch this before opening the code.","Phase 1 \u2014 Attack Surface Census: enumerate every external input (HTTP params, headers, cookies, file uploads, env vars, webhook payloads, OAuth callbacks, websocket messages, CLI args). Each is a potential injection point. Name them all.","Phase 2 \u2014 Secrets Archaeology: find every secret (API key, token, password, private key, signing secret). For each: where is it stored? How does it get to the runtime? Is it ever in a log, response body, error message, or serialized object?","Phase 3 \u2014 Dependency Supply Chain: any new npm/go/pip dependency is untrusted code. For each new dependency: check CVE databases, verify maintainer, check download counts, review the actual code for obvious backdoors. No 'it looked fine' without evidence.","OWASP Top 10 minimum: A01 Broken Access Control (check authz at every route), A02 Cryptographic Failures (check for plaintext secrets, weak ciphers), A03 Injection (check every input that touches SQL/shell/HTML/LDAP), A04 Insecure Design (check threat model exists), A05 Security Misconfiguration (check defaults), A06 Vulnerable Components (check CVEs), A07 Authentication Failures (check session management), A08 Software Integrity (check supply chain), A09 Logging Failures (check for secrets in logs, missing audit trail), A10 SSRF (check for URL-based fetches using user input).","Authorization check: every new endpoint must have explicit authorization at the handler level \u2014 not just middleware. Check: what happens if the auth middleware is misconfigured? The handler should still check. Default to deny.","STRIDE per new component: for each new component, run STRIDE: Spoofing (can an attacker impersonate?), Tampering (can they modify data in transit?), Repudiation (can they deny an action without audit trail?), Information Disclosure (can they read data they shouldn't?), Denial of Service (can they exhaust resources?), Elevation of Privilege (can they gain capabilities they shouldn't have?).","Hard FALSE POSITIVE rules \u2014 do NOT flag as vulnerabilities: (1) Hashed passwords in DB (that's correct). (2) HTTPS URLs in public config (not a secret). (3) Test/fixture secrets in test files (expected). (4) Error messages that say 'invalid' without leaking data. (5) Rate limiting that returns 429. (6) Auth redirects to login. (7) Public API keys in client-side code (designed to be public). (8) Stack traces in development mode. (9) Verbose logging in DEBUG mode. (10) Localhost-only services."],acceptanceCriteria:["Trust boundary model documented: all trust zones, entry points, and data flows mapped","Attack surface census complete: every external input enumerated with validation strategy","OWASP Top 10 checked: each applicable category verified with evidence (file:line for each check)","All user inputs validated at system boundaries \u2014 not deep in business logic","No hardcoded secrets, credentials, or private keys in code or config files","All new endpoints have explicit authorization checks \u2014 not just middleware reliance","New dependencies checked for CVEs and reviewed for supply chain risk","Secrets never appear in logs, error messages, or serialized responses","STRIDE analysis completed for each new component"],reviewDimensions:[{id:"owasp-a01-access-control",label:"A01 \u2014 Broken Access Control",prompt:"For every new endpoint, action, or resource: who can access it? Is the authorization check at the handler level (not just middleware)? What happens if the auth middleware is bypassed or misconfigured? Can a regular user access admin data? Can user A access user B's data? Test the denial paths explicitly.",evidenceRequired:!0,scope:"all"},{id:"owasp-a03-injection",label:"A03 \u2014 Injection",prompt:"Find every input that flows into a query (SQL, NoSQL, LDAP, XPath), command (shell, subprocess), or rendered output (HTML, SVG, markdown). For each: is it parameterized/escaped before use? Can an attacker inject SQL via a string field? Execute shell commands via a filename? Run XSS via a user-controlled string in HTML? Name the specific input and the sanitization/parameterization applied.",evidenceRequired:!0,scope:"all"},{id:"secrets-audit",label:"Secrets & Credentials Audit",prompt:"Find every secret in this change (API keys, tokens, passwords, signing keys, private keys). For each: (1) Is it ever in a log statement? (2) Is it ever in an error message? (3) Is it ever serialized to JSON or included in a response body? (4) Is it stored in a secure store (env var, secrets manager) or hardcoded? (5) When was it last rotated? Flag any instance where a secret could leak.",evidenceRequired:!0,scope:"all"},{id:"dependency-supply-chain",label:"Dependency Supply Chain",prompt:"List every new dependency added in this change. For each: (1) Check CVE databases (npm audit / go vuln / pip-audit). (2) Verify the maintainer. (3) Check download volume (low download count = higher risk). (4) Is the dependency necessary or could built-in stdlib do the same? Report any dependency with known CVEs or suspicious characteristics.",evidenceRequired:!0,scope:"all"},{id:"stride-analysis",label:"STRIDE Threat Model",prompt:"For each new component or endpoint, run STRIDE: (S) Spoofing \u2014 can an attacker impersonate a user or service? (T) Tampering \u2014 can they modify data in transit or at rest? (R) Repudiation \u2014 can they deny an action without an audit trail? (I) Information Disclosure \u2014 can they read data they shouldn't? (D) Denial of Service \u2014 can they exhaust resources (CPU, memory, disk, API rate limits)? (E) Elevation of Privilege \u2014 can they gain capabilities they shouldn't? Name the attack vector and the mitigation for each.",evidenceRequired:!0,scope:"all"}],lifecycle:{outsideVoice:!0},registries:["security-audit"],suggestsPosture:"selective-expansion"};var k={id:"peer-reviewed",name:"Peer Reviewed",description:"Code review is not approval-seeking. It is adversarial verification by someone who cares about the outcome. A good reviewer finds what the author missed \u2014 not to be difficult, but because the author is too close to the code to see its failure modes. Critical findings block merge. Informational findings inform. Both require a response.",category:"quality",extras:[{questionId:"verification",text:"Who will review this? What specific aspects of the code are most important to get a second pair of eyes on? Name the reviewer and the scope."},{questionId:"scope_boundary",text:"What parts of this change are you LEAST confident about? Those are the parts the reviewer should focus on most."}],specSections:[{id:"review-scope",title:"Review Scope",placeholder:"_Who will review this change? What specific aspects need a second pair of eyes? What are you LEAST confident about? Name the reviewer and the focus area._",condition:null,position:"after:acceptance-criteria"},{id:"critical-pass-items",title:"Critical Pass Items",placeholder:"_Run the Critical Pass checklist: SQL/data safety, race conditions, LLM trust boundary, shell injection, enum completeness, auth bypass. Report each finding with file:line. All must be resolved before merge._",condition:null,position:"after:acceptance-criteria"},{id:"informational-pass-items",title:"Informational Pass Items",placeholder:"_Run the Informational Pass: async/sync mixing, dead code, time window safety, overly broad catch, missing readonly, magic numbers, inconsistent naming, TODO without ticket. Non-blocking but must be documented._",condition:null,position:"after:acceptance-criteria"}],reminders:["Critical Pass \u2014 these block merge if found: (1) SQL/data safety: raw SQL concatenation, unparameterized queries. (2) Race conditions: shared mutable state without synchronization. (3) LLM trust boundary: user-controlled input injected into LLM prompts without sanitization. (4) Shell injection: user input in subprocess/exec calls. (5) Enum completeness: switch/match on an enum without a default/exhaustive check. (6) Auth bypass: any path that reaches privileged data without checking auth.","Informational Pass \u2014 flag but do not block merge: (1) Async/sync mixing: awaiting a sync function or not awaiting an async one. (2) Dead code: unreachable branches, unused variables, commented-out blocks. (3) Time window safety: `new Date()` called in a loop where a consistent timestamp matters. (4) Overly broad catch: catch(e) that swallows the error type. (5) Missing readonly: mutable state that should be immutable. (6) Magic numbers: hardcoded values without named constants. (7) Inconsistent naming: similar operations named differently. (8) TODO without ticket: a TODO comment with no associated issue or owner.","Suppressions \u2014 do NOT flag these as review findings: (1) Test-only global state. (2) Generated code. (3) Vendored/copied external code. (4) Deliberate type assertions with comments explaining why. (5) Performance trade-offs explicitly called out in comments. (6) Platform-specific workarounds with comments. (7) Migration-era compatibility code. (8) Intentional empty catch blocks for cleanup paths. (9) Non-cryptographic use of Math.random().","Fix-First heuristic: before writing the review, fix any obvious typos, formatting issues, or trivial naming problems in the diff yourself. Review comments should be reserved for semantic issues, not cosmetic ones. The review is not a style guide session.","Review Army specialist groups: (1) Testing specialist \u2014 focus on test coverage, test quality, missing edge cases. (2) Maintainability specialist \u2014 focus on readability, complexity, naming, coupling. (3) Performance specialist (activate when the diff touches hot paths) \u2014 focus on N+1 queries, missing indexes, memory growth. (4) Security specialist (activate when the diff touches auth/input/data) \u2014 focus on injection, auth bypass, data exposure."],acceptanceCriteria:["Critical Pass completed: all 6 critical categories checked with evidence","No open Critical findings at merge time","Informational Pass completed: all findings documented with suggested fix or accepted trade-off","Every finding has a response: fixed, deferred with reason, or explicitly accepted","Suppressions applied correctly: no false positives in the review findings","At least one reviewer who did not write the code reviewed the Critical Pass items"],reviewDimensions:[{id:"critical-pass",label:"Critical Pass (Merge Blockers)",prompt:"Run the Critical Pass checklist against the diff. For each: (1) SQL/data safety \u2014 any raw string interpolation in queries? (2) Race conditions \u2014 any shared mutable state accessed without synchronization? (3) LLM trust boundary \u2014 any user input flowing into LLM prompts? (4) Shell injection \u2014 any user input in exec/spawn/subprocess calls? (5) Enum completeness \u2014 any switch/match on an enum type without handling all cases or providing a default? (6) Auth bypass \u2014 any path to privileged data without an auth check? Report each finding with file:line.",evidenceRequired:!0,scope:"all"},{id:"informational-pass",label:"Informational Pass (Non-Blocking Flags)",prompt:"Run the Informational Pass checklist. For each finding: (1) Async/sync mixing. (2) Dead code. (3) Time window safety. (4) Overly broad catch. (5) Missing readonly. (6) Magic numbers. (7) Inconsistent naming. (8) TODO without ticket. Report with file:line and severity (info only \u2014 these do not block merge).",evidenceRequired:!1,scope:"all"},{id:"test-coverage-review",label:"Testing Specialist Review",prompt:"Review the test coverage in the diff. Are there tests for the new behaviors? Are there tests for the failure paths? Are any edge cases obviously missing? Do the tests actually test the behavior (not just call the function)? Would a future refactor that broke the behavior cause these tests to fail?",evidenceRequired:!0,scope:"all"}]};var I={id:"ship-ready",name:"Ship Ready",description:"Ship readiness is not about whether the feature works. It is about whether the artifact is ready for production: tests passing, coverage adequate, scope contained, changelog updated, version correct, and no outstanding hygiene debt. A feature that works but leaves the repo in worse shape is not ready to ship.",category:"delivery",extras:[{questionId:"verification",text:"What is the ship checklist? List every gate that must pass before this can merge: test command, coverage threshold, changelog entry, version bump, TODOS.md hygiene."}],specSections:[{id:"ship-checklist",title:"Ship Checklist",placeholder:"_Gate checklist before merge: full test suite passes (zero failures), coverage at or above baseline, CHANGELOG updated with version, scope audit complete (built matches spec), no unresolved TODOs without tickets, version bump correct._",condition:null,position:"after:acceptance-criteria"}],reminders:["Tests must pass: run the full test suite (not just the new tests). Zero failures, zero skips on critical paths.","Coverage threshold: new code must meet or exceed the project's coverage threshold. Do not ship code that drops coverage below the project baseline.","Scope drift audit: compare what was built to what was specced. If features crept in or out, document why. Scope drift that is unacknowledged is a planning failure.","CHANGELOG entry: every user-visible change needs a CHANGELOG entry with the version it ships in. Breaking changes need a migration note.","TODOS hygiene: resolve or ticket every TODO added during this work. A merged TODO without a ticket is lost work.","Version readiness: is the version bump correct for the change type (patch/minor/major per semver)? Does the package.json / go.mod / deno.json reflect the new version?"],acceptanceCriteria:["Full test suite passes (zero failures, zero skips on critical paths)","Coverage at or above project baseline \u2014 not below","Scope audit complete: built matches spec, deviations documented","CHANGELOG updated with user-visible changes and version","Breaking changes have migration guide with before/after examples","No unresolved TODOs without associated tickets","Version bump correct for change type (patch/minor/major)"],lifecycle:{stage:"ship"}};var x={id:"documented",name:"Documented",description:"Documentation is not a post-ship task. It is part of the definition of done. If a feature ships without documentation, it does not exist for the user who finds it six months later. Every public API change, every CLI flag change, every behavior change needs a corresponding documentation update. The diff in code must have a diff in docs.",category:"delivery",extras:[{questionId:"user_impact",text:"If a developer discovers this feature without talking to you, what do they need to know? What is the minimum documentation they would need to use it correctly?"},{questionId:"verification",text:"Which documentation files need to change as a result of this work? Name each file. What sections will be added, changed, or removed?"}],specSections:[{id:"documentation-updates",title:"Documentation Updates",placeholder:"_Name every documentation file that changes as a result of this work. For each: what sections are added, changed, or removed? The diff in code must have a diff in docs._",condition:null,position:"after:acceptance-criteria"},{id:"api-documentation",title:"API Documentation",placeholder:"_For every public API surface changed: updated function signatures, parameter descriptions, return types, and runnable code examples. Before/after examples for breaking changes._",condition:null,position:"after:acceptance-criteria"},{id:"user-guide-changes",title:"User Guide Changes",placeholder:"_What does the user-facing guide say about this feature? Which getting-started steps change? Is the README accurate for install, config, and first-run after this change?_",condition:null,position:"after:acceptance-criteria"}],reminders:["Every public API change needs a documentation update. New function, new parameter, changed behavior, changed default \u2014 update the docs before marking done.","CHANGELOG is documentation: every user-visible change must appear in CHANGELOG.md with the version, a one-line description, and a link to the relevant issue or PR.","README accuracy: if you changed how the project is installed, configured, or run, update the README. Stale README instructions are a DX failure.","Inline code comments explain WHY, not WHAT: the code explains what. Comments explain why a non-obvious choice was made. If you wrote something unusual, leave a comment that future-you will thank you for.","Migration guides for breaking changes: if any existing user would need to change their code to upgrade, write a before/after example. 'See CHANGELOG' is not a migration guide.","API reference sync: if the project has generated or maintained API reference documentation, verify it reflects the new state after this change."],acceptanceCriteria:["All changed public APIs have updated documentation (function signatures, parameters, return types, examples)","CHANGELOG updated with user-visible changes, version, and description","README accurate for install, config, and first-run steps","Breaking changes have before/after migration examples","No stale documentation describing behavior that no longer exists","Inline comments added where non-obvious choices were made"],reviewDimensions:[{id:"docs-diff-sync",label:"Documentation-to-Code Diff Sync",prompt:"For every public API surface changed in this diff (functions, methods, parameters, CLI flags, config keys, environment variables, HTTP endpoints): is there a corresponding documentation update? Find the doc file. Check the section. Confirm it reflects the new state. Flag any public change that has no documentation counterpart.",evidenceRequired:!0,scope:"api"},{id:"changelog-quality",label:"CHANGELOG Entry Quality",prompt:"Does the CHANGELOG have an entry for this change? Is it under the correct version? Does the entry describe the change from the user's perspective (not the implementation perspective)? Does it include migration instructions for any breaking change?",evidenceRequired:!0,scope:"all"}],lifecycle:{stage:"document"}};var A={id:"deploy-ready",name:"Deploy Ready",description:"Deploy readiness is not about whether the code is correct. It is about whether the infrastructure, configuration, and pipeline are ready to receive it. A correct feature with a broken deploy config ships nothing. Verify the config before the merge \u2014 not after.",category:"delivery",extras:[{questionId:"verification",text:"What deploy platform is this targeting? Is the deploy config current and correct for this change? Is there a staging environment where this can be verified before production?"}],specSections:[{id:"deploy-configuration",title:"Deploy Configuration",placeholder:"_What deploy platform? What config files need updating (fly.toml, render.yaml, vercel.json, etc.)? Can old and new config coexist during a rolling deploy? Rollback command?_",condition:null,position:"after:premises"},{id:"environment-variables",title:"Environment Variables",placeholder:"_Every new env var: name, purpose, required vs optional, example value, which environments need it. Add to deploy config, .env.example, and README if user-facing._",condition:null,position:"after:premises"},{id:"staging-verification",title:"Staging Verification",placeholder:"_Steps to verify on staging before production: deploy command, smoke test steps, health check endpoint, expected output. 'Works on my machine' is not staging verification._",condition:null,position:"after:premises"}],reminders:["Deploy config first: if the change requires a new environment variable, a new service, a new deploy target, or a changed build command \u2014 the config must be updated BEFORE the code ships.","Staging verification: the change must be deployed to staging and manually verified before production. 'Works on my machine' is not staging verification.","Environment variable audit: every new env var must be documented (name, purpose, required vs optional, example value) and added to the deploy config, the local .env.example, and the README if user-facing.","Health check: after deploy, the first action is to verify the health endpoint responds correctly. Do not declare deploy success until the health check passes.","Rollback plan: every deploy needs a documented rollback plan. What command reverts to the previous version? How long does rollback take? What data mutations need to be reversed?"],acceptanceCriteria:["Deploy platform detected and config file present (fly.toml / render.yaml / vercel.json / netlify.toml / etc.)","All new environment variables documented and added to deploy config","Staging deployment successful and manually verified","Health check passes after staging deploy","Rollback plan documented","No hardcoded staging/production URLs in application code"],lifecycle:{stage:"deploy"}};var C={id:"production-ready",name:"Production Ready",description:"Production readiness is measured in how fast you can detect and recover from failure \u2014 not whether failure is possible. Every system fails. The question is whether you know about it in minutes or days, and whether you can recover in minutes or days. Observability, alerting, and runbooks are not optional. They are the difference between a production system and a production disaster waiting to happen.",category:"delivery",extras:[{questionId:"verification",text:"What alerts will fire if this feature breaks in production? Who gets paged? What does the runbook say to do first?"},{questionId:"ambition",text:"What does a healthy canary look like 24 hours after deploy? What metrics, error rates, and latency numbers would signal that the feature is working correctly?"},{questionId:"status_quo",text:"What observability exists today for the area being changed? What gaps will this change introduce? What new metrics, logs, or traces are needed?"}],specSections:[{id:"prod-observability-plan",title:"Observability Plan",placeholder:"_For every new codepath: structured logging at entry/exit (JSON, with correlation IDs), latency percentiles (P50/P95/P99), trace ID propagation. If it is not in a dashboard, it does not exist._",condition:null,position:"after:verification-strategy"},{id:"alert-tiers",title:"Alert Tiers",placeholder:"_For every new codepath: what alert fires if it breaks? Tier: CRITICAL (page immediately), HIGH (page business hours), MEDIUM (ticket 24h), LOW (weekly review). Name the condition and the recipient._",condition:null,position:"after:verification-strategy"},{id:"prod-runbook",title:"Runbook",placeholder:"_For every CRITICAL alert: (1) what it means, (2) first diagnostic step, (3) rollback command, (4) who to escalate to. Write this before shipping, not after the first incident._",condition:null,position:"after:verification-strategy"},{id:"canary-criteria",title:"Canary Criteria",placeholder:"_24-hour canary verdict: which metrics, at what thresholds, over what window, indicate success vs failure? Example: 'Error rate on /api/checkout < 0.5% for 24h; P99 latency < 800ms; no CRITICAL alerts.'_",condition:null,position:"after:verification-strategy"}],reminders:["Alert tiers \u2014 every new codepath needs at least one alert: CRITICAL = data loss, security breach, complete service unavailability (page immediately, any time). HIGH = significant degradation, major feature broken (page during business hours). MEDIUM = partial degradation, minor feature broken (ticket within 24h). LOW = cosmetic issue, performance degradation within SLA (log for weekly review).","Structured logging: every new codepath must emit structured log entries at entry and exit (JSON format, with request ID, user ID if applicable, duration, outcome). No unstructured log.Printf / console.log with interpolated strings.","Latency percentiles: P50, P95, P99 must be measurable for any new HTTP handler or background job. If you can't measure latency, you can't detect regressions.","Error rate baseline: establish the pre-deploy error rate for the affected endpoint or job. Post-deploy, the error rate must not exceed the pre-deploy baseline by more than 0.1%.","Canary criteria: define the 24-hour canary verdict before deploy. What specific metrics, at what thresholds, over what window, would indicate success vs failure? Write the canary criteria in the spec before shipping.","Runbook: for every CRITICAL alert, there must be a runbook section that describes: (1) what the alert means, (2) the first diagnostic step, (3) the rollback command if needed, (4) who to escalate to."],acceptanceCriteria:["Structured logging added to all new codepaths (JSON format, with correlation IDs)","At least one alert configured per new codepath (tier assigned: CRITICAL/HIGH/MEDIUM/LOW)","Latency percentiles (P50/P95/P99) measurable for all new HTTP handlers","Pre-deploy error rate baseline documented for affected endpoints","Canary criteria defined: specific metrics, thresholds, and window for 24-hour verdict","Runbook entry exists for every CRITICAL-tier alert"],reviewDimensions:[{id:"observability-coverage",label:"Observability Coverage",prompt:"For every new codepath in the diff: is there structured logging at entry and exit? Does each log entry include correlation IDs (request ID, user ID, trace ID)? Is the outcome (success/failure) logged? Is the duration logged? Would an oncall engineer be able to diagnose a failure using only dashboards and logs, without reading source code?",evidenceRequired:!0,scope:"all"},{id:"alert-coverage",label:"Alert Coverage",prompt:"What alerts exist for the new codepaths? For each alert: what tier is it (CRITICAL/HIGH/MEDIUM/LOW)? What condition triggers it? Who receives it? Is there a runbook? Are there any new CRITICAL codepaths with no alert configured?",evidenceRequired:!1,scope:"all"},{id:"canary-criteria",label:"Canary Criteria",prompt:"What are the canary criteria for this change? Name the specific metrics, their thresholds, and the time window for the 24-hour verdict. Example: 'Error rate on /api/checkout < 0.5% for 24 hours; P99 latency < 800ms; no CRITICAL alerts fired'. If canary criteria are not defined, this is a red flag \u2014 a deploy without success criteria is a deploy you cannot confidently declare successful.",evidenceRequired:!1,scope:"all"}],dreamStatePrompt:"CANARY VERDICT \u2014 24 hours post-deploy: What do the dashboards show? Error rate on affected endpoints: [X]% (baseline was [Y]%). P99 latency: [X]ms (baseline was [Y]ms). CRITICAL alerts fired: [N]. HIGH alerts fired: [N]. Any unexpected patterns in logs? Any user reports of degradation? Verdict: GO (metrics within spec) or NO-GO (rollback triggered). Write the actual numbers.",lifecycle:{stage:"monitor"}};var E={id:"retro-fed",name:"Retro Fed",description:"The retrospective is where compounding learning happens. A spec completed without a retro is a missed opportunity to get better. The questions are not 'what went wrong' \u2014 they are 'what would you do differently', 'where was the model wrong', 'what did you learn that should change how you approach the next one'. Learnings that stay in one person's head compound for one person. Documented learnings compound for the team.",category:"delivery",extras:[{questionId:"status_quo",text:"What assumptions did you have at the start that turned out to be wrong? Where was your mental model off?"},{questionId:"ambition",text:"If you were starting this spec fresh today with everything you know now, what would you do differently in the first 30 minutes?"}],specSections:[{id:"retrospective-notes",title:"Retrospective Notes",placeholder:"_Written immediately at completion while context is fresh. What would you do differently if starting fresh today? Where did the plan diverge from reality? What assumptions were wrong?_",condition:null,position:"after:acceptance-criteria"},{id:"learnings",title:"Learnings",placeholder:"_At least one learning per spec. Tag mental model shifts with EUREKA: Promoted learnings should be added with `noskills learn --rule`. Cross-spec patterns belong here._",condition:null,position:"after:acceptance-criteria"},{id:"hotspots",title:"Hotspots",placeholder:"_Which files were touched most? Why? High-churn files signal wrong abstraction, misallocated responsibility, or wrong spec boundaries. Document each hotspot with a note on why it required so many changes._",condition:null,position:"after:acceptance-criteria"}],reminders:["Retro timing: the retro happens AT COMPLETION, not weeks later. Memory decays fast. Write the retrospective notes while the context is fresh \u2014 immediately after marking COMPLETED.","Hotspot analysis: what files were touched most? These are your system's pain points. High-churn files are a signal: either the abstraction is wrong, the responsibility is misallocated, or the spec boundaries are wrong. Document any hotspot with a note on why it was touched so much.","Time distribution: where did the time actually go? If planning took 10% and debugging took 60%, that is a signal \u2014 either the spec was underspecified, the codebase was more complex than expected, or a wrong hypothesis was held too long. Document where time went.","Debt that escaped this cycle: what shortcuts were taken that will need to be paid back? Document them now with a rough cost estimate. Debt that is not documented is debt that will surprise you.","Eureka moments: what changed in your mental model during this spec? What did you believe at the start that you no longer believe? These are the most valuable learnings. Tag them explicitly with 'EUREKA:'.","Per-spec metrics: how many iterations did this take? How many times did it revisit a phase? How many debt items were carried forward? These numbers compound \u2014 track them so you can see improvement over time.","Cross-spec pattern: did this spec surface a pattern that appears in other specs too? If yes, promote the learning to a permanent rule: `noskills learn --rule 'rule text'`. Learning that only lives in one spec's retro does not compound."],acceptanceCriteria:["Retrospective notes written immediately at completion (while context is fresh)","Hotspot analysis: high-churn files identified with explanation of why","At least one learning documented (use `noskills spec learn` or `noskills learn --rule`)","Eureka moments tagged explicitly with 'EUREKA:' prefix if any mental model shifted","Debt that escaped this cycle documented with rough cost estimate","Time distribution noted: where did the majority of time go?"],dreamStatePrompt:"RETROSPECTIVE REPORT \u2014 spec completed: (1) WHAT CHANGED: [what is different in the codebase/system now]. (2) HOTSPOTS: [files touched most, and why they required so many changes]. (3) MODEL SHIFTS: [what you believed at the start that turned out to be wrong \u2014 EUREKA moments]. (4) TIME DISTRIBUTION: [where the time actually went: discovery X%, spec writing Y%, implementation Z%, debugging Q%]. (5) ESCAPED DEBT: [shortcuts taken and their estimated future cost]. (6) CROSS-SPEC PATTERN: [any pattern from this spec that applies to future specs]. (7) WHAT I'D DO DIFFERENTLY: [top 3 changes to approach if starting fresh].",lifecycle:{stage:"retro"}};var R=[l,h,u,p,m,f,g,y,v,w,b,k,I,x,A,C,E];var Te=()=>Promise.resolve(R),We=(o,e)=>{let t=[];for(let i of o)for(let a of i.extras)a.questionId===e&&t.push(a);return t},Pe=(o,e)=>{let t=[];for(let i of o)for(let a of i.reminders){if(e!=null){let n=a.toLowerCase();if((n.includes("slop")||n.includes("ui element")||n.includes("design intentionality")||n.includes("interaction states")||n.includes("edge case check")||n.includes("loading state"))&&!e.involvesWebUI||(n.includes("api doc")||n.includes("endpoint should be"))&&!e.involvesPublicAPI)continue}t.push(`${i.id}: ${a}`)}return t},D=o=>{let e=o.toLowerCase();return e.includes("slop")||e.includes("ui element")||e.includes("design intentionality")||e.includes("interaction states")||e.includes("edge case check")||e.includes("loading state")||e.includes("api doc")||e.includes("endpoint should be")||e.includes("migration")||e.includes("rollback")},qe=o=>{let e=[],t=[];for(let i of o)for(let a of i.reminders){let n=`${i.id}: ${a}`;D(a)?t.push(n):e.push(n)}return{tier1:e,tier2:t}},Le=(o,e,t)=>{let i=e.includes(".")?`.${e.split(".").pop()}`:"",a=[".tsx",".jsx",".html",".css",".svelte",".vue"].includes(i),n=[".ts",".go",".py",".rs"].includes(i),c=[];for(let d of o)for(let r of d.reminders){if(!D(r))continue;let s=r.toLowerCase();(s.includes("slop")||s.includes("ui element")||s.includes("design intentionality")||s.includes("interaction states")||s.includes("edge case check")||s.includes("loading state"))&&!a||(s.includes("api doc")||s.includes("endpoint should be"))&&(!n||!t?.involvesPublicAPI)||c.push(`${d.id}: ${r}`)}return c},Ne=o=>{let e=[],t=o.map(i=>i.id);return t.includes("move-fast")&&t.includes("compliance")&&e.push({between:["move-fast","compliance"],issue:"Speed vs traceability \u2014 shortcuts may violate audit requirements."}),t.includes("move-fast")&&t.includes("long-lived")&&e.push({between:["move-fast","long-lived"],issue:"Shipping speed vs maintainability \u2014 tech debt decisions need human approval."}),t.includes("beautiful-product")&&t.includes("move-fast")&&e.push({between:["beautiful-product","move-fast"],issue:"Design polish vs speed \u2014 which UI states can be deferred?"}),t.includes("well-engineered")&&t.includes("move-fast")&&e.push({between:["well-engineered","move-fast"],issue:"Engineering rigor vs shipping speed \u2014 which quality dimensions (tests, observability, security hardening) can be deferred to v2?"}),t.includes("well-engineered")&&t.includes("learning-project")&&e.push({between:["well-engineered","learning-project"],issue:"Engineering standards vs experimentation freedom \u2014 how much test/security/observability rigor is appropriate for an experiment?"}),t.includes("move-fast")&&t.includes("security-audited")&&e.push({between:["move-fast","security-audited"],issue:"Shipping speed vs security rigor \u2014 security audit phases add time; which phases can be parallelized vs which are blockers?"}),t.includes("move-fast")&&t.includes("ship-ready")&&e.push({between:["move-fast","ship-ready"],issue:"Speed vs ship hygiene \u2014 ship-ready gates (coverage, CHANGELOG, version bump) add friction; each must be justified or automated."}),t.includes("move-fast")&&t.includes("peer-reviewed")&&e.push({between:["move-fast","peer-reviewed"],issue:"Shipping speed vs review thoroughness \u2014 Critical Pass items are non-negotiable blockers even under time pressure."}),t.includes("developer-experience")&&t.includes("compliance")&&e.push({between:["developer-experience","compliance"],issue:"Zero-friction DX vs mandatory compliance steps \u2014 required auth, data handling, or audit config adds onboarding friction that must be designed, not apologized for."}),t.includes("learning-project")&&t.includes("peer-reviewed")&&e.push({between:["learning-project","peer-reviewed"],issue:"Experimentation freedom vs review standards \u2014 experiments may intentionally violate best practices; reviewers must distinguish intentional experiments from accidental mistakes."}),t.includes("move-fast")&&t.includes("production-ready")&&e.push({between:["move-fast","production-ready"],issue:"Speed vs observability investment \u2014 structured logging, alerts, and canary criteria take time to set up but prevent much longer incidents later."}),e},Fe=(o,e)=>{let t=[];for(let i of o)for(let a of i.reviewDimensions??[])e!=null&&(a.scope==="ui"&&!e.involvesWebUI||a.scope==="api"&&!e.involvesPublicAPI||a.scope==="data"&&!e.involvesDataHandling)||t.push({...a,concernId:i.id});return t},Oe=o=>{let e=[];for(let t of o)for(let i of t.registries??[])e.includes(i)||e.push(i);return e},_e=o=>o.filter(e=>e.dreamStatePrompt!==void 0&&e.dreamStatePrompt.length>0).map(e=>e.dreamStatePrompt);export{R as a,Te as b,We as c,Pe as d,qe as e,Le as f,Ne as g,Fe as h,Oe as i,_e as j};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=r=>({_tag:"Ok",value:r,*[Symbol.iterator](){return yield this}}),n=r=>({_tag:"Fail",error:r,*[Symbol.iterator](){return yield this}}),E=r=>r._tag==="Ok",a=r=>r._tag==="Fail",T=(r,e)=>E(r)?t(e(r.value)):r;var s=(r,e)=>E(r)?e.ok(r.value):e.fail(r.error),l=async(r,e=o=>o)=>{try{return t(await r)}catch(o){return n(e(o))}};export{t as a,n as b,a as c,T as d,s as e,l as f};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{e as C}from"./chunk-KRKOWSYW.js";import{i as y}from"./chunk-Y5E7ZCCX.js";import{e as A}from"./chunk-HISXAZ4Y.js";var g=A(C(),1);var $=[{id:"summary",title:"Summary",placeholder:"_Synthesize the spec in 2-3 sentences: what changes, why it matters, for whom._",position:"base:0"},{id:"problem-statement",title:"Problem Statement",placeholder:"_Describe the current pain: what is broken, missing, or inefficient? For whom? What happens today when they try?_",position:"base:1"},{id:"ambition",title:"Ambition",placeholder:"_What does success look like? Paint the 12-month ideal state \u2014 not just this feature, but the trajectory it starts._",position:"base:2"},{id:"reversibility",title:"Reversibility",placeholder:"_If this ships and is wrong, how do we undo it? Rollback steps, feature flags, migration reversibility, blast radius._",position:"base:3"},{id:"user-impact",title:"User Impact",placeholder:"_Who benefits and how? What changes for them \u2014 before/after their day, their workflow, their frustration?_",position:"base:4"},{id:"verification-strategy",title:"Verification Strategy",placeholder:"_How will we know it worked? Automated tests, manual smoke tests, metrics to watch, acceptance checklist._",position:"base:5"},{id:"scope-boundary",title:"Scope Boundary",placeholder:"_What is explicitly OUT of scope? Name specific features, use cases, or edge cases this spec does NOT address._",position:"base:6"},{id:"premises",title:"Premises",placeholder:"_List every assumption this spec makes. If an assumption turns out wrong, what breaks?_",position:"base:7"},{id:"tasks",title:"Tasks",placeholder:"_Break implementation into concrete tasks. Each task: what it does, how to verify it is done, any ordering constraints._",position:"base:8"},{id:"acceptance-criteria",title:"Acceptance Criteria",placeholder:"_Binary, testable criteria. Each item: the system does X when Y. No fuzzy language._",position:"base:9"}],D=(e,t,s)=>typeof t=="string"?{id:`${e}-${t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}`,title:t,placeholder:`_${t}: to be addressed during discovery._`,condition:null,position:`after:tasks:${s}`}:t,M=e=>{let t=$.map(i=>({...i,condition:null})),s=new Set(t.map(i=>i.id)),n=new Map;for(let i of e)for(let a=0;a<i.specSections.length;a++){let d=i.specSections[a],l=D(i.id,d,a),u={...l,concernSource:i.id},p=l.position.match(/^after:([^:]+)/),r=p!==null?p[1]:void 0,c=r!==void 0&&s.has(r)?r:"acceptance-criteria",h=n.get(c)??[];n.set(c,[...h,u])}let o=[];for(let i of t){o.push(i);let a=n.get(i.id)??[];o.push(...a)}return o},w={involvesWebUI:e=>e.involvesWebUI,involvesCLI:e=>e.involvesCLI,involvesPublicAPI:e=>e.involvesPublicAPI,involvesMigration:e=>e.involvesMigration,involvesDataHandling:e=>e.involvesDataHandling},j=(e,t,s)=>{let n=new Map(t.map(o=>[o.id,o]));return e.map(o=>{let i=n.get(o.sectionId);if(i===void 0||i.condition===null||o.status==="filled"||o.status==="na")return o;let a=w[i.condition];if(a===void 0)return o;let d=s!==null&&a(s);return d&&o.status==="conditional-hidden"?{...o,status:"placeholder"}:!d&&o.status==="placeholder"?{...o,status:"conditional-hidden"}:o})},W=(e,t)=>{if(t===null)return"unknown";let s=[["involvesWebUI","UI work"],["involvesCLI","CLI interaction"],["involvesPublicAPI","public API changes"],["involvesMigration","migration or deprecation"],["involvesDataHandling","data handling"]],n=[];for(let[o,i]of s){if(o==="source"||o==="inferredFrom")continue;let a=e!==null?!!e[o]:!1,d=!!t[o];!a&&d&&n.push(i)}return n.length>0?n.join(", "):"project classification update"},U=(e,t)=>{let s=new Set(e.filter(a=>a.status!=="conditional-hidden").map(a=>a.sectionId)),n=new Set(t.filter(a=>a.status!=="conditional-hidden").map(a=>a.sectionId)),o=[...n].filter(a=>!s.has(a)),i=[...s].filter(a=>!n.has(a));return o.length===0&&i.length===0?null:{revealed:o,hidden:i}},O={filled:"\u2713",placeholder:"\u25CB",na:"\u2014","conditional-hidden":"\u2298"},I="<!-- TOC:START -->",v="<!-- TOC:END -->",x=e=>{let t=[I,"## Sections"];for(let s of e){let n=O[s.status];s.status==="na"&&s.naReason!==void 0?t.push(`- ${n} ${s.sectionTitle} _(N/A: ${s.naReason})_`):s.status==="conditional-hidden"?t.push(`- ${n} ${s.sectionTitle} _(hidden \u2014 condition not met)_`):t.push(`- ${n} ${s.sectionTitle}`)}return t.push(v),t.join(`
|
|
2
|
+
`)},f="---",E=e=>{let t=e.split(`
|
|
3
|
+
`);if(t[0]!==f)return{metadata:{created:{date:"",user:""},lastModified:{date:"",user:""},contributors:[],approvals:[],pendingDecisions:[]},body:e};let s=t.indexOf(f,1);if(s===-1)throw new Error("spec.md frontmatter is malformed: found opening --- but no closing ---. Inspect the file manually and restore a valid YAML frontmatter block.");let n=t.slice(1,s).join(`
|
|
4
|
+
`),o=g.parse(n),i=t.slice(s+1).join(`
|
|
5
|
+
`);return{metadata:o,body:i}},T=e=>{let t=g.stringify(e,{lineWidth:0});return`${f}
|
|
6
|
+
${t.trimEnd()}
|
|
7
|
+
${f}`},m=e=>`<!-- PLACEHOLDER:${e} -->`,F=(e,t,s)=>{let n=m(t);if(!e.includes(n))throw new Error(`Placeholder marker not found for section "${t}". spec.md may have been manually edited or this section was already filled. Inspect the file and restore the marker, or mark the section as filled in state JSON directly.`);return e.replace(n,s)},N=(e,t)=>{let s=e.indexOf(I),n=e.indexOf(v);if(s===-1||n===-1)return e;let o=x(t);return e.slice(0,s)+o+e.slice(n+v.length)},V=(e,t,s,n,o="STATED")=>e.map(i=>i.sectionId===t?{...i,status:"filled",filledBy:s,filledAt:n.toISOString(),source:o}:i);var H=e=>{let t=e.placeholders.filter(n=>!(n.status==="conditional-hidden"||n.status==="filled"||n.status==="na"&&n.naReason!==void 0&&n.naReason.trim().length>=20)).map(n=>({sectionId:n.sectionId,sectionTitle:n.sectionTitle})),s=e.metadata.pendingDecisions;return{canAdvance:t.length===0&&s.length===0,unresolvedSections:t,pendingDecisions:s}},z=(e,t,s)=>{let n=s.toISOString(),o={date:n,user:t.user},i={user:t.user,lastAction:t.type,date:n},a=e.contributors.findIndex(l=>l.user===t.user),d=a>=0?e.contributors.map((l,u)=>u===a?i:l):[...e.contributors,i];switch(t.type){case"delegation-created":{let l={section:t.section,question:t.question,waitingFor:t.waitingFor};return{...e,lastModified:o,contributors:d,pendingDecisions:[...e.pendingDecisions,l]}}case"delegation-answered":return{...e,lastModified:o,contributors:d,pendingDecisions:e.pendingDecisions.filter(l=>l.section!==t.section)};case"approval":{let l=e.approvals.findIndex(r=>r.user===t.user),u={user:t.user,status:"approved",date:n},p=l>=0?e.approvals.map((r,c)=>c===l?u:r):[...e.approvals,u];return{...e,lastModified:o,contributors:d,approvals:p}}default:return{...e,lastModified:o,contributors:d}}},R={status_quo:"problem-statement",user_impact:"user-impact",ambition:"ambition",scope_boundary:"scope-boundary",verification:"verification-strategy",reversibility:"reversibility"},q=e=>R[e]??e,Y=e=>{let{specName:t,activeConcerns:s,classification:n,creator:o,now:i}=e,a=i.toISOString(),d=M(s),l=d.map(r=>{if(r.condition===null)return{sectionId:r.id,sectionTitle:r.title,status:"placeholder",concernSource:r.concernSource};let c=w[r.condition],h=n!==null&&c!==void 0&&c(n);return{sectionId:r.id,sectionTitle:r.title,status:h?"placeholder":"conditional-hidden",concernSource:r.concernSource}}),u={created:{date:a,user:o.name},lastModified:{date:a,user:o.name},contributors:[{user:o.name,lastAction:"created",date:a}],approvals:[],pendingDecisions:[]},p=[];p.push(T(u)),p.push(`# Spec: ${t}`),p.push(x(l));for(let r of d){let c=l.find(h=>h.sectionId===r.id);c===void 0||c.status==="conditional-hidden"||p.push(`## ${r.title}
|
|
8
|
+
|
|
9
|
+
${m(r.id)}
|
|
10
|
+
${r.placeholder}`)}return{content:p.join(`
|
|
11
|
+
|
|
12
|
+
`),placeholders:l,metadata:u}},J=async e=>{let{path:t,sectionId:s,body:n,attribution:o,metadata:i,visiblePlaceholders:a}=e,d=await y.fs.readTextFile(t),{body:l}=E(d),u=T(i),p=o.date.toISOString().split("T")[0],r=`${n}
|
|
13
|
+
|
|
14
|
+
_Answered by ${o.user} on ${p}_`,c=F(l,s,r);if(c=N(c,a),e.classificationChanged){for(let h of e.newlyRevealedSections??[])c+=`
|
|
15
|
+
|
|
16
|
+
## ${h.title}
|
|
17
|
+
|
|
18
|
+
${m(h.id)}
|
|
19
|
+
${h.placeholder}`;for(let h of e.newlyHiddenIds??[]){let _=m(h),S=c.indexOf(_);if(S===-1)continue;let b=c.slice(0,S);if(/\n## [^\n]+\n/.exec(b.slice(b.lastIndexOf(`
|
|
20
|
+
## `)))===null)continue;let P=b.lastIndexOf(`
|
|
21
|
+
## `),k=c.indexOf(`
|
|
22
|
+
`,S)+1;c=c.slice(0,P)+c.slice(k)}}await y.fs.writeTextFile(t,`${u}
|
|
23
|
+
${c}`)};var Q=async(e,t)=>{try{await y.fs.stat(t);return}catch{}let s=await y.fs.readTextFile(e);await y.fs.writeTextFile(t,s)};export{M as a,j as b,W as c,U as d,V as e,H as f,z as g,q as h,Y as i,J as j,Q as k};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as S,l as w}from"./chunk-JYVB6UAV.js";import{a as A,b as R}from"./chunk-OAWYVETM.js";var u=e=>JSON.parse(e),x=e=>{let r="";for(let o=0;o<e.length;o+=32768)r+=String.fromCharCode(...e.subarray(o,o+32768));return btoa(r)},g=e=>{switch(e){case"end_turn":return"end_turn";case"max_tokens":return"max_tokens";case"tool_use":return"tool_use";default:return"stop"}},h=e=>({inputTokens:e?.inputTokens??0,outputTokens:e?.outputTokens??0,totalTokens:e?.totalTokens??0,thinkingTokens:e?.thinkingTokens}),_=e=>{if(e===void 0)return[];let t=[];for(let r of e){if(r.type==="text"&&r.text!==void 0){t.push({kind:"text",text:r.text});continue}if(r.type==="tool_call"&&r.id!==void 0&&r.name!==void 0){t.push({kind:"tool_call",toolCall:{id:r.id,name:r.name,arguments:r.arguments??{}}});continue}r.type==="tool_result"&&r.id!==void 0&&t.push({kind:"tool_result",toolResult:{toolCallId:r.id,content:r.text??"",isError:!1}})}return t},f=e=>({id:e.id,status:e.status,createdAt:new Date(e.createdAt),completedAt:e.completedAt!==void 0?new Date(e.completedAt):void 0,totalCount:e.totalCount,doneCount:e.doneCount,failedCount:e.failedCount,storage:e.storage,error:e.error}),I=e=>{switch(e.kind){case"text":return{type:"text",text:e.text};case"image":return{type:"image",image:{url:e.image.url,mimeType:e.image.mimeType,detail:e.image.detail,data:e.image.data===void 0?void 0:x(e.image.data)}};case"audio":return{type:"audio",audio:{url:e.audio.url,mimeType:e.audio.mimeType,data:e.audio.data===void 0?void 0:x(e.audio.data)}};case"file":return{type:"file",file:{uri:e.file.uri,mimeType:e.file.mimeType}};case"tool_call":return{type:"tool_call",toolCall:{id:e.toolCall.id,name:e.toolCall.name,arguments:e.toolCall.arguments}};case"tool_result":return{type:"tool_result",toolResult:{toolCallId:e.toolResult.toolCallId,content:e.toolResult.content,isError:e.toolResult.isError}};default:return{type:e.kind}}},y=(e,t)=>{let r=crypto.randomUUID();if(t===void 0)return{requestId:r,release:()=>{}};let o=()=>{try{e.symbols.EserAjanAiCancelRequest(JSON.stringify({requestId:r}))}catch{}};return t.aborted?(o(),{requestId:r,release:()=>{}}):(t.addEventListener("abort",o,{once:!0}),{requestId:r,release:()=>t.removeEventListener("abort",o)})},c=(e,t,r)=>w(e,t.error??r,t.errorKind,t.errorStatus),p=e=>new S("request aborted",{provider:e}),b=(e,t)=>{let r=e.messages.map(o=>({role:o.role,content:o.content.map(I)}));return JSON.stringify({requestId:t,messages:r,system:e.system??"",maxTokens:e.maxTokens??0,toolChoice:e.toolChoice??"",tools:e.tools,temperature:e.temperature,topP:e.topP,stopWords:e.stopWords,responseFormat:e.responseFormat,thinkingBudget:e.thinkingBudget,safetySettings:e.safetySettings,extensions:e.extensions})},B=class{capabilities;provider;modelId;#e;#t;constructor(t,r,o,n,s){this.#e=t,this.#t=r,this.provider=o,this.modelId=n,this.capabilities=s}async generateText(t,r){let{requestId:o,release:n}=y(this.#e,r);try{let s=b(t,o),i=await this.#e.symbols.EserAjanAiGenerateText(this.#t,s),a=u(i);return a.error!==void 0?R(r?.aborted===!0?p(this.provider):c(this.provider,a,"generation failed")):A({content:_(a.content),stopReason:g(a.stopReason),usage:h(a.usage),modelId:a.modelId??this.modelId})}finally{n()}}async*streamText(t,r){let{requestId:o,release:n}=y(this.#e,r),s=b(t,o),i=await this.#e.symbols.EserAjanAiStreamText(this.#t,s),a=u(i);if(a.error!==void 0||a.handle===void 0){n(),yield{kind:"error",error:r?.aborted===!0?p(this.provider):c(this.provider,a,"stream start failed")};return}let d=a.handle;try{for(;;){if(r?.aborted===!0){yield{kind:"error",error:p(this.provider)};return}let m=await this.#e.symbols.EserAjanAiStreamRead(d);if(m==="null"||m==="")break;let l=u(m);switch(l.type){case"content_delta":yield{kind:"content_delta",textDelta:l.textDelta??""};break;case"tool_call_delta":yield{kind:"tool_call_delta",textDelta:l.textDelta,toolCall:l.toolCallId===void 0?void 0:{id:l.toolCallId,name:l.toolCallName??"",arguments:l.argumentsDelta??{}}};break;case"message_done":yield{kind:"message_done",stopReason:g(l.stopReason),usage:h(l.usage)};return;case"error":yield{kind:"error",error:c(this.provider,l,"stream error")};return}}}finally{this.#e.symbols.EserAjanAiFreeStream(d),n()}}async submitBatch(t,r){let{requestId:o,release:n}=y(this.#e,r);try{let s=t.items.map(d=>({customId:d.customId,options:JSON.parse(b(d.options))})),i=await this.#e.symbols.EserAjanAiBatchCreate(JSON.stringify({requestId:o,modelHandle:this.#t,items:s})),a=u(i);if(a.error!==void 0||a.job===void 0)throw r?.aborted===!0?p(this.provider):c(this.provider,a,"batch create failed");return f(a.job)}finally{n()}}async getBatchJob(t,r){let{requestId:o,release:n}=y(this.#e,r);try{let s=await this.#e.symbols.EserAjanAiBatchGet(JSON.stringify({requestId:o,modelHandle:this.#t,jobId:t})),i=u(s);if(i.error!==void 0||i.job===void 0)throw r?.aborted===!0?p(this.provider):c(this.provider,i,"batch get failed");return f(i.job)}finally{n()}}async listBatchJobs(t,r){let{requestId:o,release:n}=y(this.#e,r);try{let s=await this.#e.symbols.EserAjanAiBatchList(JSON.stringify({requestId:o,modelHandle:this.#t,limit:t?.limit,after:t?.after})),i=u(s);if(i.error!==void 0)throw r?.aborted===!0?p(this.provider):c(this.provider,i,"batch call failed");return(i.jobs??[]).map(f)}finally{n()}}async downloadBatchResults(t,r){let{requestId:o,release:n}=y(this.#e,r),s={id:t.id,status:t.status,createdAt:t.createdAt.toISOString(),completedAt:t.completedAt?.toISOString(),totalCount:t.totalCount,doneCount:t.doneCount,failedCount:t.failedCount,storage:t.storage,error:t.error};try{let i=await this.#e.symbols.EserAjanAiBatchDownload(JSON.stringify({requestId:o,modelHandle:this.#t,job:s})),a=u(i);if(a.error!==void 0)throw r?.aborted===!0?p(this.provider):c(this.provider,a,"batch call failed");return(a.results??[]).map(d=>({customId:d.customId,result:d.result!==void 0?{content:_(d.result.content),stopReason:g(d.result.stopReason),usage:h(d.result.usage),modelId:d.result.modelId??this.modelId}:void 0,error:d.error}))}finally{n()}}async cancelBatchJob(t,r){let{requestId:o,release:n}=y(this.#e,r);try{let s=await this.#e.symbols.EserAjanAiBatchCancel(JSON.stringify({requestId:o,modelHandle:this.#t,jobId:t})),i=u(s);if(i.error!==void 0)throw r?.aborted===!0?p(this.provider):c(this.provider,i,"batch call failed")}finally{n()}}close(){return this.#e.symbols.EserAjanAiCloseModel(this.#t),Promise.resolve()}[Symbol.asyncDispose](){return this.close()}[Symbol.dispose](){this.#e.symbols.EserAjanAiCloseModel(this.#t)}getRawClient(){return null}},v=class{provider;#e;#t;constructor(t,r,o){this.#e=t,this.provider=r,this.#t=o}createModel(t){let r=JSON.stringify({provider:t.provider,apiKey:t.apiKey??"",model:t.model,baseUrl:t.baseUrl??"",projectId:t.projectId??"",location:t.location??"",maxTokens:t.maxTokens,temperature:t.temperature,requestTimeoutMs:t.requestTimeoutMs,properties:t.properties??{}}),o=this.#e.symbols.EserAjanAiCreateModel(r),n=u(o);return n.error!==void 0||n.handle===void 0?Promise.reject(c(t.provider,n,"failed to create model")):Promise.resolve(new B(this.#e,n.handle,t.provider,t.model,this.#t))}},E=[{provider:"anthropic",capabilities:["text_generation","streaming","tool_calling","vision","batch_processing","structured_output","reasoning"]},{provider:"openai",capabilities:["text_generation","streaming","tool_calling","vision","batch_processing","structured_output","reasoning"]},{provider:"gemini",capabilities:["text_generation","streaming","tool_calling","vision"]},{provider:"vertexai",capabilities:["text_generation","streaming","tool_calling","vision","batch_processing"]},{provider:"ollama",capabilities:["text_generation","streaming","vision"]},{provider:"claude-code",capabilities:["text_generation","streaming","tool_calling"]},{provider:"opencode",capabilities:["text_generation","streaming"]},{provider:"kiro",capabilities:["text_generation","streaming"]}],T=e=>E.map(({provider:t,capabilities:r})=>new v(e,t,r)),C=null,F=async()=>{try{let t=await(await import("./mod-AJIRKRAH.js")).loadEserAjan({wasm:!1});return t.symbols.EserAjanInit(),C=null,T(t)}catch(e){return C=e instanceof Error?e:new Error(String(e)),[]}},P=()=>C;export{B as a,v as b,T as c,F as d,P as e};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`);continue}let s=a.content.map(g);n.push({role:f(a.role),parts:s})}return{contents:n,systemInstruction:t}},x=e=>e.map(t=>({functionDeclarations:[{name:t.name,description:t.description,parameters:t.parameters}]})),C=(e,t)=>{let n=[],a="end_turn",s=e?.candidates??[];if(s.length>0){let r=s[0],c=r?.content?.parts??[];for(let i of c)i.text!==void 0&&n.push({kind:"text",text:i.text}),i.functionCall!==void 0&&(n.push({kind:"tool_call",toolCall:{id:i.functionCall.name,name:i.functionCall.name,arguments:i.functionCall.args??{}}}),a="tool_use");let m=r?.finishReason;m==="MAX_TOKENS"?a="max_tokens":m==="STOP"&&(a="end_turn")}let o=e?.usageMetadata;return{content:n,stopReason:a,usage:{inputTokens:o?.promptTokenCount??0,outputTokens:o?.candidatesTokenCount??0,totalTokens:o?.totalTokenCount??0},modelId:t,rawResponse:e}},R=e=>e?.status!==void 0?e.status:e?.code!==void 0?e.code:500,d=e=>{let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)};export{
|
|
1
|
+
import{h as l,i as p,j as u}from"./chunk-EJYSOUEA.js";var f=e=>e==="assistant"?"model":e==="tool"?"user":e,g=e=>{switch(e.kind){case"text":return{text:e.text};case"image":{if(e.image.data!==void 0)return{inlineData:{mimeType:e.image.mimeType??"image/png",data:d(e.image.data)}};if(e.image.url!==void 0){if(l(e.image.url)){let t=p(e.image.url);if(t!==null)return{inlineData:{mimeType:t.mimeType,data:d(t.data)}}}return{fileData:{mimeType:e.image.mimeType??u(e.image.url)??"image/png",fileUri:e.image.url}}}return{text:"[unsupported image]"}}case"audio":return e.audio.data!==void 0?{inlineData:{mimeType:e.audio.mimeType??"audio/mpeg",data:d(e.audio.data)}}:e.audio.url!==void 0?{fileData:{mimeType:e.audio.mimeType??u(e.audio.url)??"audio/mpeg",fileUri:e.audio.url}}:{text:"[unsupported audio]"};case"file":return{fileData:{mimeType:e.file.mimeType??"application/octet-stream",fileUri:e.file.uri}};case"tool_call":return{functionCall:{name:e.toolCall.name,args:e.toolCall.arguments}};case"tool_result":return{functionResponse:{name:e.toolResult.toolCallId,response:{content:e.toolResult.content}}}}},T=e=>{let t=null,n=[];for(let a of e){if(a.role==="system"){let o=[];for(let r of a.content)r.kind==="text"&&o.push(r.text);t=o.join(`
|
|
2
|
+
`);continue}let s=a.content.map(g);n.push({role:f(a.role),parts:s})}return{contents:n,systemInstruction:t}},x=e=>e.map(t=>({functionDeclarations:[{name:t.name,description:t.description,parameters:t.parameters}]})),C=(e,t)=>{let n=[],a="end_turn",s=e?.candidates??[];if(s.length>0){let r=s[0],c=r?.content?.parts??[];for(let i of c)i.text!==void 0&&n.push({kind:"text",text:i.text}),i.functionCall!==void 0&&(n.push({kind:"tool_call",toolCall:{id:i.functionCall.name,name:i.functionCall.name,arguments:i.functionCall.args??{}}}),a="tool_use");let m=r?.finishReason;m==="MAX_TOKENS"?a="max_tokens":m==="STOP"&&(a="end_turn")}let o=e?.usageMetadata;return{content:n,stopReason:a,usage:{inputTokens:o?.promptTokenCount??0,outputTokens:o?.candidatesTokenCount??0,totalTokens:o?.totalTokenCount??0},modelId:t,rawResponse:e}},R=e=>e?.status!==void 0?e.status:e?.code!==void 0?e.code:500,d=e=>{let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)};export{f as a,g as b,T as c,x as d,C as e,R as f};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as c}from"./chunk-
|
|
1
|
+
import{i as c}from"./chunk-Y5E7ZCCX.js";var p=".eser/diagrams.json",g=i=>{let t=0;for(let s=0;s<i.length;s++){let a=i.charCodeAt(s);t=(t<<5)-t+a,t|=0}return Math.abs(t).toString(36)},u=i=>{let t=new Set,s=/(?:[\w@.-]+\/)*[\w@.-]+\.(?:ts|tsx|js|jsx|go|py|rs|md|json|yaml|yml)/g,a;for(;(a=s.exec(i))!==null;)t.add(a[0]);let r=/(?:@[\w-]+\/[\w-]+|[\w-]+\/[\w-]+)/g;for(;(a=r.exec(i))!==null;)a[0].includes(".")||t.add(a[0]);return[...t]},D=async(i,t)=>{let s=`${i}/${t}`,a;try{a=await c.fs.readTextFile(s)}catch{return[]}let r=[],e=a.split(`
|
|
2
2
|
`),n=new Date().toISOString(),o=!1,h=0,m="";for(let l=0;l<e.length;l++){let d=e[l];if(d.trim().startsWith("```mermaid")){o=!0,h=l+1,m="";continue}if(o&&d.trim()==="```"){o=!1,r.push({file:t,line:h,type:"mermaid",hash:g(m),referencedFiles:u(m),lastVerified:n});continue}if(o){m+=d+`
|
|
3
3
|
`;continue}if(/[┌─┬┐│└┴┘╔═╗║╚╝╭╮╰╯]/.test(d)&&e[l+1]&&/[┌─┬┐│└┴┘╔═╗║╚╝╭╮╰╯]/.test(e[l+1])){let f="",y=l;for(;y<e.length&&/[┌─┬┐│└┴┘╔═╗║╚╝╭╮╰╯┼├┤▶→←↓↑\|+\-]/.test(e[y]);)f+=e[y]+`
|
|
4
4
|
`,y++;f.length>20&&r.push({file:t,line:l+1,type:"ascii",hash:g(f),referencedFiles:u(f),lastVerified:n})}}return r},F=async i=>{let t=[],s=[],a=async(r,e)=>{try{for await(let n of c.fs.readDir(r))n.name.startsWith(".")||n.name==="node_modules"||(n.isFile&&n.name.endsWith(".md")&&s.push(e?`${e}/${n.name}`:n.name),n.isDirectory&&!n.name.startsWith(".")&&await a(`${r}/${n.name}`,e?`${e}/${n.name}`:n.name))}catch{}};await a(i,"");for(let r of s){let e=await D(i,r);t.push(...e)}try{for await(let r of c.fs.readDir(i))if(r.isFile&&r.name.endsWith(".puml")){let e=await c.fs.readTextFile(`${i}/${r.name}`);t.push({file:r.name,line:1,type:"plantuml",hash:g(e),referencedFiles:u(e),lastVerified:new Date().toISOString()})}}catch{}return t},w=async i=>{try{let t=await c.fs.readTextFile(`${i}/${p}`);return JSON.parse(t)}catch{return[]}},S=async(i,t)=>{await c.fs.writeTextFile(`${i}/${p}`,JSON.stringify(t,null,2)+`
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as v,b as p,d as E,e as m,f,g as y}from"./chunk-CML74SNT.js";import{a as l}from"./chunk-JYVB6UAV.js";import{a as T,b as w}from"./chunk-OAWYVETM.js";var k=class{capabilities=["text_generation","streaming"];provider="kiro";modelId;binary;config;constructor(e,r){this.binary=e,this.config=r,this.modelId=r.model}async generateText(e,r){let i=b(this.config,e),c=y(e.messages,e.system),o=p(this.binary,i,{signal:r,stdinData:c}),u=m(o.stderr),t=await E(o.stdout,this.modelId),d=await o.waitForExit(),s=await u,a=f("kiro",d.code,s);return a!==null?w(a):T(t)}async*streamText(e,r){let i=b(this.config,e),c=y(e.messages,e.system),o=p(this.binary,i,{signal:r,stdinData:c}),u=m(o.stderr);try{let t=new TextDecoder,d=o.stdout.getReader(),s="",a=await d.read();for(;a.done!==!0;){s+=t.decode(a.value,{stream:!0});let h=s.split(`
|
|
2
|
+
`);s=h.pop()??"";for(let R of h){let g=R.trim();if(g.length!==0){try{let C=JSON.parse(g),S=P(C);if(S!==null){yield S;continue}}catch{}yield{kind:"content_delta",textDelta:g+`
|
|
3
|
+
`}}}a=await d.read()}d.releaseLock(),s.trim().length>0&&(yield{kind:"content_delta",textDelta:s.trim()});let _=await o.waitForExit(),A=await u,x=f("kiro",_.code,A);x!==null?yield{kind:"error",error:x}:yield{kind:"message_done",stopReason:"end_turn",usage:{inputTokens:0,outputTokens:0,totalTokens:0}}}catch(t){t instanceof l?yield{kind:"error",error:t}:yield{kind:"error",error:new l(t instanceof Error?t.message:String(t),{provider:"kiro",cause:t instanceof Error?t:void 0})}}}close(){return Promise.resolve()}getRawClient(){return null}},G={provider:"kiro",async createModel(n){let e=await v("kiro",n);return new k(e,n)}},b=(n,e)=>{let r=[];r.push("--output","json"),r.push("--model",n.model),e.maxTokens!==void 0&&r.push("--max-tokens",String(e.maxTokens));let i=n.properties?.args;return i!==void 0&&r.push(...i),r},P=n=>{if(n===null||typeof n!="object")return null;let e=n;if(e.type==="content"||e.type==="text"){let r=e.text??e.content;return r!==void 0?{kind:"content_delta",textDelta:String(r)}:null}return e.type==="done"||e.type==="result"||e.done===!0?{kind:"message_done",stopReason:"end_turn",usage:{inputTokens:e.usage?.input_tokens??0,outputTokens:e.usage?.output_tokens??0,totalTokens:(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0)}}:e.type==="error"?{kind:"error",error:new l(e.error?.message??e.message??"Unknown Kiro error",{provider:"kiro"})}:null};export{k as a,G as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as T,b as p,c as _,e as f,f as c,g as m}from"./chunk-CML74SNT.js";import{a as u}from"./chunk-JYVB6UAV.js";import{a as h,b as w}from"./chunk-OAWYVETM.js";var y=class{capabilities=["text_generation","streaming","tool_calling"];provider="claude-code";modelId;binary;config;constructor(e,t){this.binary=e,this.config=t,this.modelId=t.model}async generateText(e,t){let r=S(this.config,e,"json"),o=m(e.messages,e.system),s=p(this.binary,r,{signal:t,stdinData:o,cwd:this.config.properties?.cwd}),i=f(s.stderr),a=s.stdout.getReader(),l=[],d=new TextDecoder,g=await a.read();for(;g.done!==!0;)l.push(d.decode(g.value,{stream:!0})),g=await a.read();a.releaseLock();let v=await s.waitForExit(),b=await i,k=c("claude-code",v.code,b);if(k!==null)return w(k);let E=l.join("");return h(A(E,this.modelId))}async*streamText(e,t){let r=this.config.properties?.streamFormat??"text",o=S(this.config,e,r),s=m(e.messages,e.system),i=p(this.binary,o,{signal:t,stdinData:s,cwd:this.config.properties?.cwd}),a=f(i.stderr);try{r==="stream-json"?yield*this.#t(i,a):yield*this.#e(i,a)}catch(l){l instanceof u?yield{kind:"error",error:l}:yield{kind:"error",error:new u(l instanceof Error?l.message:String(l),{provider:"claude-code",cause:l instanceof Error?l:void 0})}}}async*#e(e,t){let r=new TextDecoder,o=e.stdout.getReader(),s=await o.read();for(;s.done!==!0;){let d=r.decode(s.value,{stream:!0});d.length>0&&(yield{kind:"content_delta",textDelta:d}),s=await o.read()}o.releaseLock();let i=await e.waitForExit(),a=await t,l=c("claude-code",i.code,a);l!==null?yield{kind:"error",error:l}:yield{kind:"message_done",stopReason:"end_turn",usage:{inputTokens:0,outputTokens:0,totalTokens:0}}}async*#t(e,t){for await(let i of _(e.stdout)){let a=C(i);a!==null&&(yield a)}let r=await e.waitForExit(),o=await t,s=c("claude-code",r.code,o);s!==null&&(yield{kind:"error",error:s})}close(){return Promise.resolve()}getRawClient(){return null}},G={provider:"claude-code",async createModel(n){let e=await T("claude",n);return new y(e,n)}},S=(n,e,t)=>{let r=[];t!=="text"&&r.push("--output-format",t),t==="stream-json"&&r.push("--verbose"),n.model!==""&&r.push("--model",n.model);let o=n.properties?.maxTurns;o!==void 0&&r.push("--max-turns",String(o));let s=n.properties?.allowedTools;if(s!==void 0)for(let a of s)r.push("--allowedTools",a);let i=n.properties?.args;return i!==void 0&&r.push(...i),r},A=(n,e)=>{let t=n.trim(),r=s=>({content:[{kind:"text",text:s}],stopReason:"end_turn",usage:{inputTokens:0,outputTokens:0,totalTokens:0},modelId:e});try{let s=JSON.parse(t);return Array.isArray(s)?R(s,e):x(s,e)}catch{}let o=[];for(let s of t.split(/\r?\n/)){let i=s.trim();if(i.length!==0)try{o.push(JSON.parse(i))}catch{}}return o.length>0?R(o,e):t.startsWith("{")||t.startsWith("[")?r(""):r(t)},R=(n,e)=>{let t=o=>o!==null&&typeof o=="object",r=n.find(o=>t(o)&&o.type==="result"&&o.result!==void 0);if(r!==void 0)return x(r,e);for(let o=n.length-1;o>=0;o--){let s=n[o];if(t(s)&&s.type==="assistant"&&t(s.message))return x(s,e)}return{content:[{kind:"text",text:""}],stopReason:"end_turn",usage:{inputTokens:0,outputTokens:0,totalTokens:0},modelId:e}},x=(n,e)=>{let t=[];if(n.result!==void 0)t.push({kind:"text",text:String(n.result)});else if(n.message?.content!==void 0)for(let r of n.message.content)r.type==="text"?t.push({kind:"text",text:r.text}):r.type==="tool_use"&&t.push({kind:"tool_call",toolCall:{id:r.id??r.name,name:r.name,arguments:r.input??{}}});else typeof n=="string"&&t.push({kind:"text",text:n});return t.length===0&&t.push({kind:"text",text:""}),{content:t,stopReason:n.stop_reason==="tool_use"?"tool_use":"end_turn",usage:{inputTokens:n.usage?.input_tokens??0,outputTokens:n.usage?.output_tokens??0,totalTokens:(n.usage?.input_tokens??0)+(n.usage?.output_tokens??0)},modelId:e,rawResponse:n}},C=n=>{if(n===null||typeof n!="object")return null;let e=n;if(e.type==="assistant"){if(e.message?.content!==void 0){for(let t of e.message.content)if(t.type==="text")return{kind:"content_delta",textDelta:t.text}}return null}return e.type==="content_block_delta"?e.delta?.type==="text_delta"?{kind:"content_delta",textDelta:e.delta.text}:null:e.type==="result"?{kind:"message_done",stopReason:e.subtype==="tool_use"?"tool_use":"end_turn",usage:{inputTokens:e.usage?.input_tokens??0,outputTokens:e.usage?.output_tokens??0,totalTokens:(e.usage?.input_tokens??0)+(e.usage?.output_tokens??0)}}:e.type==="error"?{kind:"error",error:new u(e.error?.message??"Unknown Claude Code error",{provider:"claude-code"})}:e.content!==void 0&&typeof e.content=="string"?{kind:"content_delta",textDelta:e.content}:null};export{y as a,G as b,A as c};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as w,k as x}from"./chunk-JYVB6UAV.js";import{a as _,b}from"./chunk-OAWYVETM.js";var h=class{capabilities=["text_generation","streaming","tool_calling","vision","batch_processing","structured_output","reasoning"];provider="openai";modelId;client;config;constructor(t,n){this.client=t,this.config=n,this.modelId=n.model}async generateText(t,n){let o=p(this.config,t);try{let s=await this.client.chat.completions.create(o,{signal:n,timeout:this.config.requestTimeoutMs});return _(R(s,this.modelId))}catch(s){return b(d(s))}}async*streamText(t,n){let o=p(this.config,t);try{let s=await this.client.chat.completions.create({...o,stream:!0},{signal:n,timeout:this.config.requestTimeoutMs}),r=new Map,a=0,i=0;for await(let u of s){let c=u.choices?.[0];if(c===void 0)continue;let m=c.delta;if(m?.content!==void 0&&m.content!==null&&(yield{kind:"content_delta",textDelta:m.content}),m?.tool_calls!==void 0)for(let l of m.tool_calls){let f=l.index??0,y=r.get(f);y===void 0?r.set(f,{id:l.id??"",name:l.function?.name??"",args:l.function?.arguments??""}):y.args+=l.function?.arguments??""}if(c.finish_reason!==void 0&&c.finish_reason!==null){for(let[,l]of r){let f={};try{f=JSON.parse(l.args||"{}")}catch{}yield{kind:"tool_call_delta",toolCall:{id:l.id,name:l.name,arguments:f}}}u.usage!==void 0&&(a=u.usage.prompt_tokens??0,i=u.usage.completion_tokens??0),yield{kind:"message_done",stopReason:C(c.finish_reason),usage:{inputTokens:a,outputTokens:i,totalTokens:a+i}}}}}catch(s){yield{kind:"error",error:d(s)}}}async submitBatch(t,n){let s=t.items.map(a=>{let i=p(this.config,a.options);return JSON.stringify({custom_id:a.customId,method:"POST",url:"/v1/chat/completions",body:i})}).join(`
|
|
2
2
|
`),r=new Blob([s],{type:"application/jsonl"});try{let a=await this.client.files.create({file:r,purpose:"batch"},{signal:n}),i=await this.client.batches.create({input_file_id:a.id,endpoint:"/v1/chat/completions",completion_window:"24h"},{signal:n});return g(i)}catch(a){throw d(a)}}async getBatchJob(t,n){try{let o=await this.client.batches.retrieve(t,{signal:n});return g(o)}catch(o){throw d(o)}}async listBatchJobs(t,n){try{let o=await this.client.batches.list({limit:t?.limit,after:t?.after},{signal:n}),s=[];for(let r of o.data??[])s.push(g(r));return s}catch(o){throw d(o)}}async downloadBatchResults(t,n){let o=t.storage?.outputRef;if(o===void 0)return[];try{let a=(await(await this.client.files.content(o,{signal:n})).text()).split(`
|
|
3
|
-
`).filter(u=>u.length>0),i=[];for(let u of a){let c=JSON.parse(u);c.response?.status_code===200?i.push({customId:c.custom_id,result:
|
|
4
|
-
`)});continue}if(o.role==="tool"){for(let r of o.content)r.kind==="tool_result"&&n.push({role:"tool",tool_call_id:r.toolResult.toolCallId,content:r.toolResult.content});continue}let s=o.content.map(
|
|
3
|
+
`).filter(u=>u.length>0),i=[];for(let u of a){let c=JSON.parse(u);c.response?.status_code===200?i.push({customId:c.custom_id,result:R(c.response.body,this.modelId)}):i.push({customId:c.custom_id,error:c.error?.message??"Unknown error"})}return i}catch(s){throw d(s)}}async cancelBatchJob(t,n){try{await this.client.batches.cancel(t,{signal:n})}catch(o){throw d(o)}}async close(){}getRawClient(){return this.client}},j={provider:"openai",async createModel(e){let{default:t}=await import("./openai-HHE35TAX.js"),n={};e.apiKey!==void 0&&(n.apiKey=e.apiKey),e.baseUrl!==void 0&&(n.baseURL=e.baseUrl);let o=new t(n);return new h(o,e)}},p=(e,t)=>{let n=B(t.messages,t.system),o={model:e.model,messages:n,max_tokens:t.maxTokens??e.maxTokens};return t.temperature!==void 0&&(o.temperature=t.temperature),t.topP!==void 0&&(o.top_p=t.topP),t.stopWords!==void 0&&(o.stop=t.stopWords),t.tools!==void 0&&(o.tools=t.tools.map(s=>({type:"function",function:{name:s.name,description:s.description,parameters:s.parameters??{type:"object",properties:{}}}}))),t.toolChoice!==void 0&&(o.tool_choice=t.toolChoice),t.responseFormat!==void 0&&(t.responseFormat.type==="json_schema"?o.response_format={type:"json_schema",json_schema:{name:t.responseFormat.name??"response",schema:t.responseFormat.jsonSchema,strict:!0}}:t.responseFormat.type==="json_object"&&(o.response_format={type:"json_object"})),t.thinkingBudget!==void 0&&(o.reasoning_effort=v(t.thinkingBudget)),o},B=(e,t)=>{let n=[];t!==void 0&&n.push({role:"system",content:t});for(let o of e){if(o.role==="system"){let r=[];for(let a of o.content)a.kind==="text"&&r.push(a.text);n.push({role:"system",content:r.join(`
|
|
4
|
+
`)});continue}if(o.role==="tool"){for(let r of o.content)r.kind==="tool_result"&&n.push({role:"tool",tool_call_id:r.toolResult.toolCallId,content:r.toolResult.content});continue}let s=o.content.map(T);s.length===1&&s[0]?.type==="text"?n.push({role:o.role,content:s[0].text}):n.push({role:o.role,content:s})}return n},T=e=>{switch(e.kind){case"text":return{type:"text",text:e.text};case"image":{let t;if(e.image.url!==void 0)t=e.image.url;else if(e.image.data!==void 0)t=`data:${e.image.mimeType??"image/png"};base64,${k(e.image.data)}`;else return{type:"text",text:"[unsupported image]"};return{type:"image_url",image_url:{url:t,detail:e.image.detail??"auto"}}}case"audio":{if(e.audio.data!==void 0){let t=e.audio.mimeType??"audio/mpeg",n=A(t);return{type:"input_audio",input_audio:{data:k(e.audio.data),format:n}}}return{type:"text",text:"[unsupported audio format]"}}case"tool_call":return{type:"function",id:e.toolCall.id,function:{name:e.toolCall.name,arguments:JSON.stringify(e.toolCall.arguments)}};default:return{type:"text",text:`[unsupported content: ${e.kind}]`}}},R=(e,t)=>{let n=[],o="end_turn",s=e.choices?.[0];if(s!==void 0){if(s.message?.content!==void 0&&s.message.content!==null&&n.push({kind:"text",text:s.message.content}),s.message?.tool_calls!==void 0)for(let r of s.message.tool_calls){let a={};try{a=JSON.parse(r.function?.arguments??"{}")}catch{}n.push({kind:"tool_call",toolCall:{id:r.id,name:r.function?.name??"",arguments:a}})}o=C(s.finish_reason)}return{content:n,stopReason:o,usage:{inputTokens:e.usage?.prompt_tokens??0,outputTokens:e.usage?.completion_tokens??0,totalTokens:e.usage?.total_tokens??0},modelId:t,rawResponse:e}},C=e=>e==="stop"?"end_turn":e==="length"?"max_tokens":e==="tool_calls"?"tool_use":"end_turn",g=e=>({id:e.id,status:S(e.status),createdAt:new Date(e.created_at*1e3),completedAt:e.completed_at!==void 0?new Date(e.completed_at*1e3):void 0,totalCount:e.request_counts?.total??0,doneCount:e.request_counts?.completed??0,failedCount:e.request_counts?.failed??0,storage:{type:"openai_file",inputRef:e.input_file_id,outputRef:e.output_file_id}}),S=e=>e==="completed"?"completed":e==="failed"?"failed":e==="cancelled"||e==="cancelling"?"cancelled":e==="in_progress"||e==="finalizing"?"processing":"pending",v=e=>e<=1e3?"low":e>=1e4?"high":"medium",A=e=>e.includes("mp3")||e.includes("mpeg")?"mp3":e.includes("wav")?"wav":e.includes("flac")?"flac":e.includes("ogg")?"ogg":"mp3",d=e=>{if(e instanceof w)return e;let t=e instanceof Error?e:new Error(String(e)),n=e?.status??e?.statusCode??500;return x("openai",n,t)},k=e=>{let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)};export{h as a,j as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var c=class{stdinData;stdinOffset=0;stdoutChunks=[];stderrChunks=[];instance=null;exitCode=null;constructor(e={}){this.stdinData=e.stdin??new Uint8Array(0)}getStdout(){let e=this.stdoutChunks.reduce((r,s)=>r+s.length,0),n=new Uint8Array(e),t=0;for(let r of this.stdoutChunks)n.set(r,t),t+=r.length;return new TextDecoder().decode(n)}getExitCode(){return this.exitCode}getMemory(){if(this.instance===null)throw new Error("WASI shim: instance not set");let e=this.instance.exports.memory;return new DataView(e.buffer)}getMemoryBytes(){if(this.instance===null)throw new Error("WASI shim: instance not set");let e=this.instance.exports.memory;return new Uint8Array(e.buffer)}setInstance(e){this.instance=e}start(e){this.setInstance(e);let n=e.exports._start;if(typeof n!="function")throw new Error("WASI shim: no _start export found");try{n()}catch(t){if(t instanceof b){if(this.exitCode=t.code,t.code!==0)throw t;return}throw t}}initialize(e){this.setInstance(e);let n=e.exports._initialize;if(typeof n=="function"){n();return}let t=e.exports._start;if(typeof t=="function")try{t()}catch(r){if(r instanceof b&&r.code===0)return;throw r}}get wasiImport(){return{fd_write:(e,n,t,r)=>{let s=this.getMemory(),u=this.getMemoryBytes(),o=0;for(let i=0;i<t;i++){let m=n+i*8,S=s.getUint32(m,!0),_=s.getUint32(m+4,!0),R=u.slice(S,S+_);if(e===1)this.stdoutChunks.push(R);else if(e===2)this.stderrChunks.push(R);else return 8;o+=_}return s.setUint32(r,o,!0),0},fd_read:(e,n,t,r)=>{if(e!==0)return 8;let s=this.getMemory(),u=this.getMemoryBytes(),o=0;for(let i=0;i<t;i++){let m=n+i*8,S=s.getUint32(m,!0),_=s.getUint32(m+4,!0),R=this.stdinData.length-this.stdinOffset,a=Math.min(_,R);if(a>0&&(u.set(this.stdinData.subarray(this.stdinOffset,this.stdinOffset+a),S),this.stdinOffset+=a,o+=a),a<_)break}return s.setUint32(r,o,!0),0},fd_close:e=>0,fd_seek:(e,n,t,r,s)=>52,fd_fdstat_get:(e,n)=>{let t=this.getMemory();return t.setUint8(n,2),t.setUint16(n+2,0,!0),t.setBigUint64(n+8,BigInt(0),!0),t.setBigUint64(n+16,BigInt(0),!0),e<=2?0:8},fd_fdstat_set_flags:(e,n)=>0,fd_prestat_get:(e,n)=>8,fd_prestat_dir_name:(e,n,t)=>8,proc_exit:e=>{throw this.exitCode=e,new b(e)},clock_time_get:(e,n,t)=>{let r=this.getMemory(),s=BigInt(Date.now())*BigInt(1e6);return r.setBigUint64(t,s,!0),0},environ_sizes_get:(e,n)=>{let t=this.getMemory();return t.setUint32(e,0,!0),t.setUint32(n,0,!0),0},environ_get:(e,n)=>0,args_sizes_get:(e,n)=>{let t=this.getMemory();return t.setUint32(e,0,!0),t.setUint32(n,0,!0),0},args_get:(e,n)=>0,path_open:()=>52,path_filestat_get:()=>52,path_create_directory:()=>52,path_remove_directory:()=>52,path_unlink_file:()=>52,path_rename:()=>52,path_readlink:()=>52,path_symlink:()=>52,fd_readdir:()=>52,fd_filestat_get:()=>52,fd_filestat_set_size:()=>52,fd_filestat_set_times:()=>52,fd_advise:()=>52,fd_allocate:()=>52,fd_datasync:()=>52,fd_sync:()=>52,fd_pread:()=>52,fd_pwrite:()=>52,fd_renumber:()=>52,fd_tell:()=>52,poll_oneoff:(e,n,t,r)=>{let s=this.getMemory();for(let u=0;u<t;u++){let o=e+u*48,i=n+u*32,m=s.getBigUint64(o,!0);s.setBigUint64(i,m,!0),s.setUint16(i+8,0,!0),s.setUint8(i+10,s.getUint8(o+8))}return s.setUint32(r,t,!0),0},random_get:(e,n)=>{let t=this.getMemoryBytes(),r=new Uint8Array(n);return crypto.getRandomValues(r),t.set(r,e),0},sched_yield:()=>0,sock_accept:()=>52,sock_recv:()=>52,sock_send:()=>52,sock_shutdown:()=>52}}},b=class extends Error{code;constructor(e){super(`WASI proc_exit(${e})`),this.name="WasiExitError",this.code=e}};export{c as a};
|