@glyphier/cli 0.1.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/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import{a as Se,b as Ge,c as Me,d as Oe,e as ze,f as Ke,g as Be,h as qe,i as y,j as Ue,k as He,l as Qe,m as We,n as Je}from"./chunk-MCPBJALB.js";import{A as de,B as ge,C as fe,D as ue,E as xe,F as ye,G as be,H as he,I as Ee,J as ke,K as Ie,L as we,M as Ce,N as Ae,O as ve,P as Fe,Q as Re,R as _e,S as Le,T as Te,U as $e,V as Pe,a as L,b as T,c as $,d as G,e as M,f as U,g as H,h as Q,i as W,j as J,k as V,l as X,m as Y,n as Z,o as ee,p as te,q as re,r as ne,s as ie,t as se,u as oe,v as ae,w as le,x as pe,y as ce,z as me}from"./chunk-VOGFZYFC.js";import{a as je,b as Ne}from"./chunk-QYSMWA6Y.js";import{a as P,b as D,c as O,d as z,e as K,f as B,g as q,h as De,i as g}from"./chunk-NIXOREHQ.js";function Xe(e){switch(e){case"calls":return"called_by";case"called_by":return"calls";case"imports":return"imported_by";case"imported_by":return"imports";case"tests":return"tested_by";case"tested_by":return"tests";default:return null}}import w from"path";var f=class{name="nextjs";detect(r){return r.some(n=>{let t=n.replace(/\\/g,"/");return t.includes("next.config.")||t.includes("/app/")||t.startsWith("app/")||t.includes("/pages/")})}classifyFileRole(r){let n=r.replace(/\\/g,"/"),t=w.basename(n);return/^page\.(tsx|jsx|js)$/.test(t)?"page":/^layout\.(tsx|jsx|js)$/.test(t)?"layout":/^route\.(ts|js)$/.test(t)?"route":/^middleware\.(ts|js)$/.test(t)?"middleware":/^loading\.(tsx|jsx|js)$/.test(t)?"loading":/^error\.(tsx|jsx|js)$/.test(t)?"error":null}enrichSymbol(r){let n=this.classifyFileRole(r.filePath);if(!n)return null;if(n==="route"){let t=r.name.toUpperCase();if(["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"].includes(t)){let i=r.filePath.replace(/\\/g,"/"),s=i.indexOf("app/"),o="/";return s!==-1&&(o="/"+i.slice(s+4).replace(/\/route\.[a-z]+$/,"")),{framework:"nextjs",role:"route",method:t,endpoint:o,description:`Next.js API route handler: ${t} ${o}`}}}return n==="page"?{framework:"nextjs",role:"page",description:`Next.js page component: ${r.name}`}:null}};var x=class{adapters=[];constructor(){this.register(new f)}register(r){this.adapters.push(r)}detectFrameworks(r){return this.adapters.filter(n=>n.detect(r))}getAdapter(r){return this.adapters.find(n=>n.name===r)}getAll(){return[...this.adapters]}},st=new x;import C from"path";function pt(e){let r=e.getAllFiles(),n=new Map;for(let t of r){if(t.classification==="TEST"||t.classification==="BUILD_OUTPUT"||t.classification==="VENDOR")continue;let i=t.path.replace(/\\/g,"/").split("/"),s="core";i.length>2&&(i[0]==="src"||i[0]==="packages"||i[0]==="pkg")?s=i[1]:i.length>1&&(s=i[0]);let o=n.get(s);o||(o={id:`domain-${s}`,kind:"domain",name:s.charAt(0).toUpperCase()+s.slice(1),description:`Domain subsystem: ${s}`,symbols:[],routes:[],dependencies:[],tests:[]},n.set(s,o));let u=e.getSymbolsByFile(t.path);for(let d of u)(d.kind==="fn"||d.kind==="method"||d.kind==="class")&&o.symbols.push(d.qualifiedName||d.name),(d.kind==="route"||d.name.startsWith("GET_")||d.name.startsWith("POST_"))&&o.routes?.push(`${d.name} (${t.path})`)}for(let t of r)if(t.classification==="TEST"){let i=C.basename(t.path).replace(/\.(test|spec)\.[^.]+$/,"");for(let[s,o]of n.entries())(t.path.includes(s)||o.symbols.some(u=>u.toLowerCase().includes(i.toLowerCase())))&&o.tests?.push(t.path)}return{entities:Array.from(n.values())}}import{createHash as A}from"crypto";import{z as a}from"zod";var b=a.string().regex(/^ssym_[a-f0-9]{64}$/),v=a.string().regex(/^lent_[a-f0-9]{64}$/),ut=a.object({claimId:a.string().regex(/^[a-f0-9]{64}$/),fromSnapshotId:a.string().regex(/^[a-f0-9]{64}$/),toSnapshotId:a.string().regex(/^[a-f0-9]{64}$/),fromSymbolId:b,toSymbolId:b,logicalEntityId:v,evidenceDigests:a.array(a.string().regex(/^[a-f0-9]{64}$/)).min(1),replayAlgorithm:a.string().min(1),replayInputDigest:a.string().regex(/^[a-f0-9]{64}$/),confidence:a.number().min(0).max(1),issuedAt:a.string().datetime(),schemaVersion:a.literal("0.1")});function xt(e,r=.9,n=.05){let t=[...e].filter(s=>s.evidenceDigests.length>0).sort((s,o)=>o.score-s.score),i=t[0];return i?i.score<r?{outcome:"abstained",reason:"insufficient_proof"}:t[1]&&i.score-t[1].score<n?{outcome:"abstained",reason:"ambiguous"}:{outcome:"mapped",winner:i}:{outcome:"abstained",reason:"no_candidate"}}function yt(e,r,n){return`ssym_${h([e,r,n])}`}function bt(e,r){return`lent_${h([e,r])}`}function h(e){return A("sha256").update(e.join("\0")).digest("hex")}import{z as p}from"zod";var S=p.enum(["bash","c","c_sharp","cpp","elixir","elm","go","java","javascript","kotlin","lua","php","python","ruby","rust","swift","tsx","typescript","zig"]),E=p.enum(["parse","symbols","imports_exports","call_edges","semantic_search","slice","impact","snapshot","diff","freshness","evidence","identity"]),F=p.enum(["unqualified","provisional","calibrated","high_risk_qualified"]),kt=p.object({language:S,framework:p.string().min(1).default("generic"),taskClass:p.enum(["bug_fix","refactor","feature","review","investigation"]),riskTier:p.enum(["low","medium","high","critical"]),compilerFingerprint:p.string().regex(/^[a-f0-9]{64}$/),supportedCapabilities:p.array(E).min(1),fixtures:p.number().int().nonnegative(),falseSufficiencyEvents:p.number().int().nonnegative(),calibration:F}),It=S.options,R=E.options;function _(e,r){return e===0?1:r===0?3/e:Math.min(1,(r+3)/e)}function wt(e){let r=new Set(e.supportedCapabilities);return R.some(n=>!r.has(n))||e.calibration==="unqualified"?!1:e.calibration==="provisional"?e.fixtures>=30:e.calibration==="calibrated"?e.fixtures>=100:e.fixtures>=150&&_(e.fixtures,e.falseSufficiencyEvents)<=.02}import{createHmac as k,timingSafeEqual as j}from"crypto";import{z as l}from"zod";var N=l.enum(["local","team","enterprise"]),_t=l.object({eventId:l.string().regex(/^[a-f0-9]{64}$/),tenantId:l.string().min(1),repositoryId:l.string().min(1),principalId:l.string().min(1),scope:N,sensitivity:l.enum(["public","internal","restricted"]),receipt:y,invalidatesReceiptIds:l.array(l.string().regex(/^[a-f0-9]{64}$/)),expiresAt:l.string().datetime().nullable(),signature:l.string().regex(/^[a-f0-9]{64}$/),schemaVersion:l.literal("0.1")});function jt(e,r){return{...e,signature:k("sha256",r).update(I(e)).digest("hex")}}function Nt(e,r,n){if(e.tenantId!==n||e.scope==="local")return!1;let{signature:t,...i}=e,s=k("sha256",r).update(I(i)).digest("hex");return j(Buffer.from(t,"hex"),Buffer.from(s,"hex"))}function I(e){return JSON.stringify(e,(r,n)=>n&&typeof n=="object"&&!Array.isArray(n)?Object.fromEntries(Object.entries(n).sort(([t],[i])=>t.localeCompare(i))):n)}export{g as ARTIFACT_SCHEMA_VERSION,Oe as AnalysisSnapshotSchema,F as CalibrationStateSchema,E as CapabilitySchema,Be as ContextArtifactSchema,Le as ContextLedger,L as DEFAULT_CONFIG,Ue as DecisionClassSchema,He as DecisionPacketSchema,O as EXTENSION_TO_LANGUAGE,ze as EvidenceAnchorSchema,Ke as EvidenceRefSchema,x as FrameworkRegistry,S as GlyphierLanguageSchema,P as GlyphierStorage,ut as IdentityMappingClaimSchema,kt as LanguageCapabilityProfileSchema,v as LogicalEntityIdSchema,G as MtimeCache,f as NextJsAdapter,De as PRODUCT_VERSION,It as REGISTERED_LANGUAGE_CATALOG,R as REQUIRED_CAPABILITIES,qe as ReceiptKindSchema,y as ReceiptSchema,Me as SnapshotFreshnessSchema,b as SnapshotSymbolIdSchema,Ge as SourceAuthoritySchema,_t as SyncEnvelopeSchema,N as SyncScopeSchema,Q as abbreviateType,te as analyzeImpact,de as analyzeModuleGraph,ye as applyAstPatch,We as assertJevEligible,we as assertPaidLicense,Je as buildAnalysisSnapshot,pt as buildKnowledgeGraph,J as buildTree,wt as canPromoteCalibration,Ae as classifyFile,xe as clearSession,fe as computeProgramSlice,ue as computeSessionDelta,be as computeStats,ve as computeSymbolId,bt as createLogicalEntityId,yt as createSnapshotSymbolId,K as detectLanguage,Qe as digestCanonical,Fe as extractSymbolsFromIR,$e as extractTaskKeywords,$ as findProjectRoot,ae as formatCheckSExpr,pe as formatDeltaSExpr,oe as formatDiffSExpr,ge as formatGraphSExpr,se as formatImpactSExpr,Se as formatJSON,ie as formatSExpr,X as formatSearchResults,le as formatSliceSExpr,he as formatStatsSExpr,Ne as formatTraceSExpr,ne as formatTrie,W as generateIR,ke as getApiKey,Te as getContextLedger,Xe as getInverseEdgeKind,Ee as getMachineFingerprint,D as getStorage,q as getSupportedLanguages,M as globalCache,st as globalFrameworkRegistry,_e as indexProject,z as initTreeSitter,T as loadConfig,B as loadLanguage,Pe as optimizeContext,Y as parseFile,H as parseFileTree,Z as parseProject,U as parseSource,me as preflightCheck,ce as projectBudget,ee as readRaw,Ce as reportTokenTelemetry,xt as resolveIdentity,Re as resolveModuleEdges,V as searchIR,re as semanticDiff,jt as signSyncEnvelope,je as traceSymbol,_ as upperFalseSufficiencyBound,Ie as verifyLicense,Nt as verifySyncEnvelope};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{c as r}from"../chunk-BJ2IE33Q.js";import"../chunk-VOGFZYFC.js";import"../chunk-QYSMWA6Y.js";import"../chunk-H6T36TY5.js";import"../chunk-NIXOREHQ.js";r().catch(e=>{console.error("[glyphier-mcp] Fatal error:",e),process.exit(1)});
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-I6N5RRFT.js";export{a as executeReplan};
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-H6T36TY5.js";export{a as RepositoryMemory};
@@ -0,0 +1 @@
1
+ import{b as a,c as b,d as c}from"./chunk-PCRAPKFZ.js";export{b as buildTaskPlanSpec,a as classifyTaskIntent,c as compileTaskPlan};
@@ -0,0 +1 @@
1
+ import{a,b}from"./chunk-QYSMWA6Y.js";export{b as formatTraceSExpr,a as traceSymbol};
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "@glyphier/cli",
3
+ "version": "0.1.0",
4
+ "description": "Glyphier 0.1: evidence-governed semantic context for AI engineering agents.",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "glyphier": "dist/bin/glyphier.js",
10
+ "glyphier-mcp": "dist/mcp/glyphier-server.js"
11
+ },
12
+ "type": "module",
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "scripts": {
17
+ "build": "tsup",
18
+ "dev": "tsup --watch",
19
+ "typecheck": "tsc --noEmit",
20
+ "format:check": "bunx prettier --check 'src/**/*.ts' 'test/**/*.ts'",
21
+ "format": "bunx prettier --write 'src/**/*.ts' 'test/**/*.ts'",
22
+ "test": "vitest run test/core test/format test/mcp",
23
+ "test:unit": "vitest run test/unit",
24
+ "test:integration": "vitest run test/integration",
25
+ "test:contract": "vitest run test/contract",
26
+ "test:security": "vitest run test/security test/unit/security",
27
+ "test:performance": "vitest run test/performance --reporter=verbose",
28
+ "test:e2e": "bun run build && vitest run test/e2e",
29
+ "test:watch": "vitest",
30
+ "test:all": "vitest run test/core test/format test/mcp test/unit test/integration test/contract",
31
+ "check": "bun run format:check && bun run typecheck && bun run test:all"
32
+ },
33
+ "keywords": [
34
+ "ai",
35
+ "mcp",
36
+ "tree-sitter",
37
+ "code-representation",
38
+ "s-expression",
39
+ "intermediate-representation",
40
+ "context-optimization",
41
+ "claude-code",
42
+ "cursor"
43
+ ],
44
+ "author": "Glyphier Team",
45
+ "license": "UNLICENSED",
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/glyphier/glyphier.git"
49
+ },
50
+ "homepage": "https://glyphier.com",
51
+ "bugs": {
52
+ "url": "https://github.com/glyphier/glyphier/issues"
53
+ },
54
+ "files": [
55
+ "dist",
56
+ "queries",
57
+ "README.md",
58
+ "LICENSE"
59
+ ],
60
+ "dependencies": {
61
+ "@modelcontextprotocol/sdk": "^1.6.1",
62
+ "commander": "^13.1.0",
63
+ "fast-glob": "^3.3.3",
64
+ "ignore": "^7.0.3",
65
+ "tree-sitter-wasms": "^0.1.13",
66
+ "web-tree-sitter": "^0.24.7",
67
+ "zod": "^4.6.5"
68
+ },
69
+ "devDependencies": {
70
+ "@types/node": "^22.13.9",
71
+ "tiktoken": "^1.0.20",
72
+ "tsup": "^8.4.0",
73
+ "typescript": "^5.8.2",
74
+ "vitest": "^3.0.8"
75
+ }
76
+ }
@@ -0,0 +1,18 @@
1
+ ;; Go Tags Query
2
+
3
+ (function_declaration
4
+ name: (identifier) @name) @definition.function
5
+
6
+ (method_declaration
7
+ name: (field_identifier) @name) @definition.function
8
+
9
+ (type_spec
10
+ name: (type_identifier) @name) @definition.type
11
+
12
+ (call_expression
13
+ function: [
14
+ (identifier) @call
15
+ (selector_expression) @call
16
+ ]) @reference.call
17
+
18
+ (import_declaration) @reference.import
@@ -0,0 +1,16 @@
1
+ ;; Python Tags Query
2
+
3
+ (function_definition
4
+ name: (identifier) @name) @definition.function
5
+
6
+ (class_definition
7
+ name: (identifier) @name) @definition.class
8
+
9
+ (call
10
+ function: [
11
+ (identifier) @call
12
+ (attribute) @call
13
+ ]) @reference.call
14
+
15
+ (import_statement) @reference.import
16
+ (import_from_statement) @reference.import
@@ -0,0 +1,24 @@
1
+ ;; Rust Tags Query
2
+
3
+ (function_item
4
+ name: (identifier) @name) @definition.function
5
+
6
+ (struct_item
7
+ name: (type_identifier) @name) @definition.type
8
+
9
+ (enum_item
10
+ name: (type_identifier) @name) @definition.type
11
+
12
+ (trait_item
13
+ name: (type_identifier) @name) @definition.type
14
+
15
+ (impl_item) @definition.class
16
+
17
+ (call_expression
18
+ function: [
19
+ (identifier) @call
20
+ (field_expression) @call
21
+ (scoped_identifier) @call
22
+ ]) @reference.call
23
+
24
+ (use_declaration) @reference.import
@@ -0,0 +1,26 @@
1
+ ;; TypeScript / JavaScript Tags Query
2
+
3
+ (function_declaration
4
+ name: (identifier) @name) @definition.function
5
+
6
+ (arrow_function) @definition.function
7
+
8
+ (method_definition
9
+ name: (property_identifier) @name) @definition.function
10
+
11
+ (class_declaration
12
+ name: (type_identifier) @name) @definition.class
13
+
14
+ (interface_declaration
15
+ name: (type_identifier) @name) @definition.type
16
+
17
+ (type_alias_declaration
18
+ name: (type_identifier) @name) @definition.type
19
+
20
+ (call_expression
21
+ function: [
22
+ (identifier) @call
23
+ (member_expression) @call
24
+ ]) @reference.call
25
+
26
+ (import_statement) @reference.import