@deveco/deveco-cli-common 1.3.4
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 +21 -0
- package/README.md +1683 -0
- package/SKILL.md +235 -0
- package/THIRD-PARTY-LICENSES +4634 -0
- package/dist/cli.js +1421 -0
- package/dist/internal/doc-init-background.js +1 -0
- package/dist/internal/telemetry-upload-background.js +9 -0
- package/docs.zip +4 -0
- package/index.zip +0 -0
- package/package.json +106 -0
- package/scripts/postinstall.mjs +29 -0
- package/src/resources/aclPermission/aclPermissionsInfo.json +311 -0
- package/src/resources/arkts-check.cjs +3642 -0
- package/templates/application/AppScope/app.json5 +10 -0
- package/templates/application/AppScope/resources/base/element/string.json +8 -0
- package/templates/application/AppScope/resources/base/media/layered_image.json +7 -0
- package/templates/application/build-profile.json5 +42 -0
- package/templates/application/code-linter.json5 +32 -0
- package/templates/application/entry/build-profile.json5 +33 -0
- package/templates/application/entry/gitignore.txt +6 -0
- package/templates/application/entry/hvigorfile.ts +7 -0
- package/templates/application/entry/obfuscation-rules.txt +20 -0
- package/templates/application/entry/oh-package.json5 +10 -0
- package/templates/application/entry/src/main/ets/entryability/EntryAbility.ets +63 -0
- package/templates/application/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +31 -0
- package/templates/application/entry/src/main/ets/pages/Index.ets +38 -0
- package/templates/application/entry/src/main/module.json5 +50 -0
- package/templates/application/entry/src/main/resources/base/element/color.json +8 -0
- package/templates/application/entry/src/main/resources/base/element/float.json +8 -0
- package/templates/application/entry/src/main/resources/base/element/string.json +16 -0
- package/templates/application/entry/src/main/resources/base/media/layered_image.json +7 -0
- package/templates/application/entry/src/main/resources/base/profile/backup_config.json +3 -0
- package/templates/application/entry/src/main/resources/base/profile/main_pages.json +5 -0
- package/templates/application/entry/src/main/resources/dark/element/color.json +8 -0
- package/templates/application/gitignore.txt +13 -0
- package/templates/application/hvigor/hvigor-config.json5 +23 -0
- package/templates/application/hvigorfile.ts +7 -0
- package/templates/application/oh-package.json5 +10 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as L from"fs";import re from"proper-lockfile";import ne from"ora";import*as m from"fs";import*as b from"path";var G=["harmonyos-guides","harmonyos-references","best-practices","harmonyos-faqs","harmonyos-releases","harmonyos-roadmap"],O={"harmonyos-guides":"\u5F00\u53D1\u6307\u5357","harmonyos-references":"API\u53C2\u8003","best-practices":"\u6700\u4F73\u5B9E\u8DF5","harmonyos-faqs":"FAQ","harmonyos-releases":"\u7248\u672C\u8BF4\u660E","harmonyos-roadmap":"\u53D8\u66F4\u9884\u544A"};var N="1.9.1",ge=48*1024*1024;var he=Object.fromEntries(G.map((t,e)=>[O[t],e])),P=Object.fromEntries(G.map((t,e)=>[t,e]));import*as w from"fs";import*as a from"path";import{fileURLToPath as gt}from"url";import*as p from"fs";import*as mt from"path";import{homedir as Gt}from"os";import*as ut from"fs";import*as l from"path";function j(t,e){let r=l.relative(e,t);return r===""||!l.isAbsolute(r)&&!r.startsWith(`..${l.sep}`)&&r!==".."}function E(t){let e=l.resolve(t),r=[],n=e;for(;;)try{let o=ut.realpathSync(n);return r.length===0?o:l.join(o,...r.reverse())}catch(o){if(o.code!=="ENOENT")throw o;let u=l.dirname(n);if(u===n)return e;r.push(l.basename(n)),n=u}}function lt(t,e){let r=E(e),n=E(t);return j(n,r)?n:null}function Z(t){let e=t.trim();return(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1).trim()),e}function dt(t){let e=Z(t);if(!e)throw new Error("Path must not be empty.");return E(e)}var jt="deveco-cli",H,h=class extends Error{constructor(e){super(e),this.name="CliDataDirError"}};function pt(){let t=process.env.DEVECO_CLI_DATA_DIR,r=(t===void 0||t===""?"":Z(t))||mt.join(Gt(),".local","share",jt);try{return dt(r)}catch(n){throw new h(n instanceof Error?n.message:String(n))}}async function ft(){let t=pt();await p.promises.mkdir(t,{recursive:!0});let e;try{e=await p.promises.realpath(t)}catch(n){throw new h(`DEVECO_CLI_DATA_DIR is not usable: ${n instanceof Error?n.message:String(n)}`)}if(!(await p.promises.stat(e)).isDirectory())throw new h("DEVECO_CLI_DATA_DIR must be a writable directory.");return H=e,e}function M(){if(H!==void 0)return H;let t=pt();try{if(p.existsSync(t))return p.realpathSync(t)}catch{}return t}var Zt="docs";function Q(){return a.join(M(),Zt)}function c(){return a.join(Q(),".index")}function B(){return a.join(c(),"build.lock")}function T(){return a.join(c(),"build-status.json")}function _(){return a.join(c(),"build-meta.json")}function x(){return a.join(c(),"search.db")}function A(){return a.join(c(),".tmp")}function Ht(t,e){let r=e;for(;!r.endsWith(`${a.sep}dist`)&&r!==a.dirname(r);)r=a.dirname(r);return r}function ht(t,e){return a.dirname(Ht(t,e))}function St(){let t=gt(import.meta.url),e=a.dirname(t);return t.includes(`${a.sep}dist${a.sep}`)?ht(t,e):a.join(e,"..","..","..")}function Qt(...t){let e=gt(import.meta.url),r=a.dirname(e);return e.includes(`${a.sep}dist${a.sep}`)?[a.join(ht(e,r),...t)]:[a.join(r,"..","..","..",...t)]}function yt(...t){let e=St(),r=w.realpathSync(e);for(let n of Qt(...t))try{let o=w.lstatSync(n);if(o.isSymbolicLink()||!o.isFile())throw new Error(`Unsafe documentation package asset: ${t.join("/")} must be a regular file.`);let u=w.realpathSync(n);if(!j(u,r))throw new Error(`Unsafe documentation package asset: ${t.join("/")} is outside the package.`);return u}catch(o){if(o.code!=="ENOENT")throw o}return null}function C(){return yt("docs.zip")}function X(){return yt("index.zip")}function Et(){return a.join(St(),"index","data")}import*as S from"fs";import*as D from"path";var f=["harmonyos-terms.txt","harmonyos-synonyms.json","harmonyos-stopwords.txt"],W=class extends Error{constructor(e){super(e),this.name="LexiconNotFoundError"}};var _t=null;function Xt(){if(_t)return _t;let t=c();if(f.every(o=>S.existsSync(D.join(t,o))))return t;let r=Et();if(f.every(o=>S.existsSync(D.join(r,o))))return r;throw new W("Lexicon files not found. Install the documentation index first (index.zip).")}function $(t){let e=D.join(Xt(),t);return S.readFileSync(e,"utf-8")}function xt(t,e){return S.readFileSync(D.join(e,t),"utf-8")}import*as q from"fs";import*as Wt from"yauzl";function Y(){let t=C();return t!==null&&q.existsSync(t)}import*as d from"fs";import*as g from"path";import At from"adm-zip";import*as I from"fs";import*as v from"path";var F=class extends Error{constructor(e){super(`Unsafe documentation path: ${e}`),this.name="DocPathSafetyError"}};function K(t){return t instanceof h||t instanceof F||t instanceof Error&&(t.name==="CliDataDirError"||t.name==="DocPathSafetyError")}function tt(t){return new F(t)}function $t(){return E(M())}function J(t,e,r){let n=lt(t,e);if(n===null)throw tt(`${r} resolves outside the data directory.`);return n}async function V(t,e){await I.promises.mkdir(t,{recursive:!0});let r=J(t,e,"directory");if(!(await I.promises.stat(r)).isDirectory())throw tt("path must be a directory.")}function qt(t){let e=$t();try{let r=J(t,e,"file");if(!I.statSync(r).isFile())throw tt("path must be a regular file.")}catch(r){if(r.code==="ENOENT"){J(v.dirname(t),e,"file parent");return}throw r}}async function k(t={}){let e=t.mode??"write",r=await ft();await V(Q(),r),await V(c(),r),e==="write"&&await V(A(),r);for(let n of[x(),_(),T(),B(),...f.map(o=>v.join(c(),o))])qt(n)}var et=["search.db","build-meta.json",...f],Yt=["corpus.json","corpus-offsets.json","orama.dpack"];async function Vt(t){for(let e of Yt)await d.promises.rm(g.join(t,e),{force:!0})}function Ct(t){let r=new At(t).getEntry("build-meta.json");if(!r)throw new Error("index.zip is missing build-meta.json");return JSON.parse(r.getData().toString("utf-8"))}async function Jt(t){let e=c();await d.promises.mkdir(e,{recursive:!0});for(let r of et){let n=g.join(e,r);await d.promises.rm(n,{force:!0}),await d.promises.rename(g.join(t,r),n)}await Vt(e),await d.promises.rm(A(),{recursive:!0,force:!0})}function wt(t){let e=X();if(!e)return!1;try{let r=Ct(e);return r.indexVersion===N&&r.docsZipSha256===t&&r.segmentCount>0}catch{return!1}}async function Tt(t){await k({mode:"write"});let e=X();if(!e)throw new Error("index.zip not found");let r=Ct(e);if(r.docsZipSha256!==t)throw new Error("Bundled index.zip does not match docs.zip. Rebuild index.zip with npm run build:index.");if(r.segmentCount<=0)throw new Error("Bundled index.zip is empty");let n=A();await d.promises.rm(n,{recursive:!0,force:!0}),await d.promises.mkdir(n,{recursive:!0});let o=new At(e);for(let y of et){let ct=o.getEntry(y);if(!ct)throw new Error(`index.zip is missing ${y}`);await d.promises.writeFile(g.join(n,y),ct.getData())}let u=JSON.parse(await d.promises.readFile(g.join(n,"build-meta.json"),"utf-8"));if(!d.existsSync(g.join(n,"search.db")))throw new Error("index.zip is missing search.db");return await Jt(n),u}async function Dt(){await d.promises.rm(A(),{recursive:!0,force:!0});let t=c();for(let e of et)await d.promises.rm(g.join(t,e),{force:!0})}import{createHash as It}from"crypto";import*as bt from"fs";async function z(t){return new Promise((e,r)=>{let n=It("sha256"),o=bt.createReadStream(t);o.on("data",u=>n.update(u)),o.on("error",r),o.on("end",()=>e(n.digest("hex")))})}function Rt(t){return It("sha256").update(t,"utf8").digest("hex")}function Lt(t,e){let r=e?xt(t,e):$(t);return Rt(r)}function Ot(t){return Lt("harmonyos-synonyms.json",t)}function Nt(t){return Lt("harmonyos-terms.txt",t)}var Kt={state:"idle",phase:0,phaseLabel:"Idle",current:0,total:0,message:"",startedAt:0,updatedAt:0,error:null};async function Pt(){try{let t=await m.promises.readFile(T(),"utf-8");return JSON.parse(t)}catch{return{...Kt}}}async function rt(t){let e=T();await m.promises.mkdir(b.dirname(e),{recursive:!0}),await m.promises.writeFile(e,JSON.stringify(t,null,2))}function Mt(t){let e=Date.now();return{state:"installing",phase:1,phaseLabel:"Preparing documentation index",current:0,total:0,message:t,startedAt:e,updatedAt:e,error:null}}async function R(t){let r={...await Pt(),...t,updatedAt:Date.now()};return await rt(r),r}async function nt(){let t=C();return t?z(t):null}async function ot(){try{let t=await m.promises.readFile(_(),"utf-8");return JSON.parse(t)}catch{return null}}async function it(t=!1){if(t)return"no-index";let e=await ot();if(!e||e.segmentCount===0)return"no-index";let r=await nt();return r&&e.docsZipSha256!==r?"docs-changed":e.indexVersion!==N?"engine-upgraded":e.termsHash!==Nt()?"terms-changed":e.synonymsHash!==Ot()?"synonyms-changed":null}function st(){if(!Y()||!m.existsSync(x())||!m.existsSync(_()))return!1;let t=b.dirname(x());if(!f.every(e=>m.existsSync(b.join(t,e))))return!1;try{let e=m.readFileSync(_(),"utf-8");return JSON.parse(e).segmentCount>0}catch{return!1}}async function Bt(t=!1){return t?!0:Y()?st()?await it()!==null:!0:!1}import{createRequire as te}from"module";var Wr=te(import.meta.url);var Ft=["harmonyos-releases","harmonyos-roadmap"],wn=new Set(Ft.map(t=>P[t])),Tn=Ft.map(t=>`${O[t]}/`);var oo=Promise.resolve();var ee=null,vt=null;function kt(){vt?.resetCache(),ee=null,vt=null}function at(){kt()}async function zt(t,e,r){e?.start(r),await R({state:"installing",phase:1,phaseLabel:"Installing index",message:r}),await Tt(t),at(),e&&(e.text="Documentation index installed.")}async function oe(t,e){try{return await zt(t,e,"Installing documentation index\u2026"),await Ut(e),!0}catch(r){if(K(r))throw r}try{return await Dt(),at(),await zt(t,e,"Retrying documentation index install\u2026"),await Ut(e),!0}catch(r){if(K(r))throw r;return!1}}async function Ut(t){await R({state:"done",phase:3,phaseLabel:"Done",message:"Documentation ready.",error:null}),t?.succeed("Documentation ready.")}async function ie(t){let e=await ot(),r=e?`Documentation already up to date. Documents: ${e.segmentCount.toLocaleString()}`:"Documentation already up to date.";t?.succeed(r),await R({state:"done",message:r,error:null})}async function se(t,e){let r=t instanceof Error?t.message:String(t);throw await R({state:"error",error:r}),e?.fail(r),t}async function ae(){let t=c();await L.promises.mkdir(t,{recursive:!0});let e=B();return L.existsSync(e)||await L.promises.writeFile(e,"","utf-8"),e}async function ce(){let t=await ae();return re.lock(t,{stale:1800*1e3})}async function ue(){let t=C(),e=(t?await z(t):null)??await nt();if(!e)throw new Error("docs.zip not found");return e}async function le(t,e){let r=await ue(),n=t.force||await Bt(t.force),o=await it(t.force);if(!n&&!o&&st()){await ie(e);return}if(!(wt(r)&&await oe(r,e)))throw new Error("Documentation index bundle is unavailable or corrupted. Reinstall the package with: npm uninstall -g @deveco/deveco-cli && npm install -g <package.tgz>")}var U=class{static async run(e={}){let r=e.background??!1,o=e.quiet??r?void 0:ne({text:"Checking documentation\u2026",color:"cyan"}),u;try{e.assumeStorageSafe||await k({mode:"write"}),u=await ce(),await rt(Mt("Starting documentation setup\u2026")),await le(e,o)}catch(y){throw u&&await se(y,o),y}finally{u&&await u()}}};var de=process.env.DEVECO_CLI_POSTINSTALL?"postinstall":"doc-init";U.run({background:!0,builtBy:de}).then(()=>{process.exit(0)}).catch(()=>{process.exit(1)});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Nt from"path";import*as S from"fs";import*as Y from"path";import{homedir as gt}from"os";import*as H from"fs";import*as m from"path";function J(r){let t=m.resolve(r),e=[],n=t;for(;;)try{let i=H.realpathSync(n);return e.length===0?i:m.join(i,...e.reverse())}catch(i){if(i.code!=="ENOENT")throw i;let o=m.dirname(n);if(o===n)return t;e.push(m.basename(n)),n=o}}function P(r){let t=r.trim();return(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&(t=t.slice(1,-1).trim()),t}function K(r){let t=P(r);if(!t)throw new Error("Path must not be empty.");return J(t)}var ht="deveco-cli",W,N=class extends Error{constructor(t){super(t),this.name="CliDataDirError"}};function yt(){let r=process.env.DEVECO_CLI_DATA_DIR,e=(r===void 0||r===""?"":P(r))||Y.join(gt(),".local","share",ht);try{return K(e)}catch(n){throw new N(n instanceof Error?n.message:String(n))}}function X(){if(W!==void 0)return W;let r=yt();try{if(S.existsSync(r))return S.realpathSync(r)}catch{}return r}import mt from"crypto";import d from"fs";import z from"os";import y from"path";import St from"https";var q={devecoApiTraceUpload:"https://cn.devecostudio.huawei.com/codeGenie/cli/trace/upload"};var D=class r{static ENDPOINT=q.devecoApiTraceUpload;static SENDER="deveco-cli";async upload(t,e){let n={"Content-Type":"application/json",sender:r.SENDER,deviceid:e.replace(/-/g,""),"Content-Length":String(Buffer.byteLength(t,"utf8"))};try{let{body:i}=await this.httpPost(r.ENDPOINT,n,Buffer.from(t,"utf8"),6e4);return r.isSuccess(i)}catch{return!1}}static isSuccess(t){try{let e=JSON.parse(t),n=e?.code??e?.errorCode;return String(n)==="200"}catch{return!1}}async httpPost(t,e,n,i){let o=new URL(t);return new Promise((s,p)=>{let l=St.request({protocol:o.protocol,hostname:o.hostname,port:o.port||(o.protocol==="https:"?443:80),path:o.pathname+o.search,method:"POST",headers:e,timeout:i},v=>{let h=[];v.on("data",w=>h.push(w)),v.on("end",()=>{s({code:v.statusCode??0,body:Buffer.concat(h).toString("utf8")})})});l.on("timeout",()=>{l.destroy(new Error("request timeout"))}),l.on("error",p),l.write(n),l.end()})}};var G={identity:r=>r,camelCase:r=>r,snakeCase:r=>r.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").toLowerCase()},M=class{constructor(t={}){this.config=t}serialize(t){let e=this.transform(t);return this.config.pretty?JSON.stringify(e,null,2):JSON.stringify(e)}toObject(t){return this.transform(t)}transform(t){if(t==null)return t;if(Array.isArray(t))return t.map(o=>this.transform(o));if(typeof t!="object")return t;let e=this.config.namingStrategy??G.identity,n=this.config.fieldNames??{},i={};for(let[o,s]of Object.entries(t)){let p=n[o]??e(o);i[p]=this.transform(s)}return i}},Z=new M({namingStrategy:G.snakeCase,fieldNames:{}});import E from"crypto";import C from"fs";import Et from"path";var L="aes-256-gcm",xt=12,Tt="deveco-cli-trace-file",bt="trace-file-secret",tt=32;function Q(r){try{let t=C.readFileSync(r,"utf8").trim();return t&&Buffer.from(t,"base64").length===tt?t:null}catch{return null}}function et(r){let t=Et.join(r,bt),e=Q(t);if(e)return j(e);let n=E.randomBytes(tt).toString("base64");try{C.mkdirSync(r,{recursive:!0});try{C.writeFileSync(t,n,{flag:"wx"})}catch{let i=Q(t);if(i)return j(i);C.writeFileSync(t,n)}}catch{}return j(n)}function j(r){return E.createHash("sha256").update(Tt).update(r).digest()}function $(r,t){let e=E.randomBytes(xt),n=E.createCipheriv(L,t,e),i=Buffer.concat([n.update(r,"utf8"),n.final()]),o={version:1,algorithm:L,ciphertext:i.toString("base64"),iv:e.toString("base64"),authTag:n.getAuthTag().toString("base64")};return JSON.stringify(o)}function rt(r,t){let e;try{e=JSON.parse(r)}catch{return null}if(!wt(e))return r;try{let n=E.createDecipheriv(L,t,Buffer.from(e.iv,"base64"));return n.setAuthTag(Buffer.from(e.authTag,"base64")),Buffer.concat([n.update(Buffer.from(e.ciphertext,"base64")),n.final()]).toString("utf8")}catch{return null}}function wt(r){if(!r||typeof r!="object")return!1;let t=r;return t.version===1&&t.algorithm===L&&typeof t.ciphertext=="string"&&typeof t.iv=="string"&&typeof t.authTag=="string"}import*as a from"fs";import*as A from"path";import*as _ from"os";import*as g from"path";import ce from"json5";function nt(){if(process.platform==="win32"){let r=process.env.LOCALAPPDATA??g.join(_.homedir(),"AppData","Local");return g.join(r,"devecocli-mcp-server","logs")}return process.platform==="darwin"?g.join(_.homedir(),"Library","Logs","devecocli-mcp-server"):g.join(_.homedir(),".local","share","devecocli-mcp-server","logs")}var it="mcp-server.log",Dt="mcp-server",Ct={maxSize:10*1024*1024,maxFiles:4},B=class r{fd=null;logDir=null;currentLogFile=null;mode;rotationOptions;currentFileSize=0;currentDate="";isRotating=!1;minLevel;static LEVEL_ORDER={debug:0,info:1,warn:2,error:3};constructor(t,e){this.rotationOptions={...Ct,...e},this.minLevel=t?"debug":"info",t?(this.mode="console",this.logDir=null,this.currentLogFile=null):(this.mode="file",this.logDir=nt(),this.currentLogFile=A.join(this.logDir,it),a.existsSync(this.logDir)||a.mkdirSync(this.logDir,{recursive:!0}),this.cleanupOrphanLogFiles(),this.openLogFile())}getCurrentDateString(){let t=new Date,e=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0");return`${e}-${n}-${i}`}getRotatedFileName(t,e){return A.join(this.logDir,`${Dt}-${t}.log.${e}`)}fileExists(t){try{return a.accessSync(t,a.constants.F_OK),!0}catch{return!1}}cleanupOrphanLogFiles(){if(this.logDir)try{let t=a.readdirSync(this.logDir),e=[];for(let i of t)if(i===it||/^mcp-server-\d{4}-\d{2}-\d{2}\.log\.\d+$/.test(i)){let o=A.join(this.logDir,i),s=a.statSync(o);e.push({name:i,mtime:s.mtime,path:o})}e.sort((i,o)=>o.mtime.getTime()-i.mtime.getTime());let n=1+this.rotationOptions.maxFiles;for(let i=n;i<e.length;i++)try{a.unlinkSync(e[i].path)}catch{}}catch{}}rotateLog(){if(!(this.isRotating||!this.logDir||!this.currentLogFile)){this.isRotating=!0;try{if(this.closeLogFile(),!this.fileExists(this.currentLogFile)){this.isRotating=!1,this.openLogFile();return}let t=this.getCurrentDateString(),e=this.getRotatedFileName(t,this.rotationOptions.maxFiles);this.fileExists(e)&&a.unlinkSync(e);for(let i=this.rotationOptions.maxFiles-1;i>=1;i--){let o=this.getRotatedFileName(t,i),s=this.getRotatedFileName(t,i+1);this.fileExists(o)&&a.renameSync(o,s)}let n=this.getRotatedFileName(t,1);a.renameSync(this.currentLogFile,n),this.cleanupOrphanLogFiles(),this.openLogFile()}catch{this.openLogFile()}finally{this.isRotating=!1}}}openLogFile(){if(this.currentLogFile){this.currentDate=this.getCurrentDateString();try{if(this.fileExists(this.currentLogFile)){let t=a.statSync(this.currentLogFile);this.currentFileSize=t.size}else this.currentFileSize=0}catch{this.currentFileSize=0}try{this.fd=a.openSync(this.currentLogFile,"a")}catch{this.fd=null}}}closeLogFile(){if(this.fd!==null){try{a.closeSync(this.fd)}catch{}this.fd=null}}checkRotation(t){let e=this.getCurrentDateString();this.currentDate&&this.currentDate!==e&&(this.rotateLog(),this.currentDate=e),this.currentFileSize+=t,this.currentFileSize>=this.rotationOptions.maxSize&&this.rotateLog()}write(t,e,...n){if(this.mode==="silent"||r.LEVEL_ORDER[t]<r.LEVEL_ORDER[this.minLevel])return;let i=n.map(l=>l instanceof Error?`${l.name}: ${l.message}`:typeof l=="object"?JSON.stringify(l,null,2):String(l)).join(" "),o=i?`${e} ${i}`:e,p=`[${new Date().toLocaleString("sv-SE",{timeZone:"Asia/Shanghai",hour12:!1})+"."+String(new Date().getMilliseconds()).padStart(3,"0")}] [MCP/${t.toUpperCase()}] ${o}
|
|
2
|
+
`;if(this.mode==="file"&&this.currentLogFile){if(this.fd===null&&this.openLogFile(),this.fd!==null)try{let l=Buffer.from(p);a.writeSync(this.fd,l),this.checkRotation(l.byteLength)}catch{this.closeLogFile(),this.openLogFile()}}else this.mode==="console"&&process.stderr.write(p)}debug(t,...e){this.write("debug",t,...e)}info(t,...e){this.write("info",t,...e)}warn(t,...e){this.write("warn",t,...e)}error(t,...e){this.write("error",t,...e)}dispose(){this.closeLogFile()}flush(){if(!(this.mode!=="file"||this.fd===null))try{a.fsyncSync(this.fd)}catch{}}getLogFilePath(){return this.currentLogFile}getLogDirectory(){return this.logDir}},x=null;function Lt(r=!1){x&&x.dispose(),x=new B(r)}function F(){return x||Lt(!1),x}var f={debug:(r,...t)=>F().debug(r,...t),info:(r,...t)=>F().info(r,...t),warn:(r,...t)=>F().warn(r,...t),error:(r,...t)=>F().error(r,...t)};import ot from"fs";import _t from"path";var k=300*1e3,O=3600*1e3,st=10080*60*1e3;function R(){let r=process.env.DEVECO_CLI_DISABLE_TELEMETRY;return r==="1"||r==="true"}var Ft="upload-state.json";function at(r){return _t.join(r,Ft)}function At(){return{firstEventAt:null,lastUploadAt:null,lastRetryAt:null}}function U(r){try{let t=ot.readFileSync(at(r),"utf8"),e=JSON.parse(t);return{firstEventAt:typeof e.firstEventAt=="number"?e.firstEventAt:null,lastUploadAt:typeof e.lastUploadAt=="number"?e.lastUploadAt:null,lastRetryAt:typeof e.lastRetryAt=="number"?e.lastRetryAt:null}}catch{return At()}}function V(r,t){try{ot.writeFileSync(at(r),JSON.stringify(t),"utf8")}catch{}}function lt(r){let t=U(r);t.firstEventAt===null&&(t.firstEventAt=Date.now(),V(r,t))}function ct(r){let t=U(r);t.lastUploadAt=Date.now(),t.firstEventAt=null,V(r,t)}function ut(r){let t=U(r);t.lastRetryAt=Date.now(),V(r,t)}function pt(r){let t=r.match(/^telemetry-(\d{4})-(\d{2})-(\d{2})\.txt$/);if(!t)return null;let e=Date.parse(`${t[1]}-${t[2]}-${t[3]}T00:00:00`);return Number.isFinite(e)?e:null}import kt from"crypto";import I from"fs";import Ot from"path";var Rt="install-id";function It(r){return Ot.join(r,Rt)}function ft(r){try{let t=I.readFileSync(r,"utf8").trim();return Pt(t)?t:null}catch{return null}}function Pt(r){return/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(r)}function dt(r){let t=It(r),e=ft(t);if(e)return e;let n=kt.randomUUID();try{I.mkdirSync(r,{recursive:!0});try{I.writeFileSync(t,n,{flag:"wx"})}catch{let i=ft(t);if(i)return i;I.writeFileSync(t,n)}}catch{}return n}var T=class r{static MAX_BATCH=200;static MAX_PAYLOAD_BYTES=Math.floor(1.7*1024*1024);static TRACE_OS_VERSION="1.0";static COUNTRY_CODE="CN";static EVENT_PREFIX="devecocli_";uploader=new D;storageDir="";failedDir="";installId="";disabled=R();traceFileKey=Buffer.alloc(0);sessionId=mt.randomUUID();cliVersion="";devecoStudioVersion=null;sourceType="";cltVersion=null;nodeVersion="";initialTimer=null;intervalTimer=null;retryInitialTimer=null;retryTimer=null;flushChain=Promise.resolve();constructor(){f.info(`[telemetry] instance created, sessionId=${this.sessionId}`)}init(t){this.storageDir=t,this.failedDir=y.join(t,"failed"),this.cliVersion="1.3.4",this.nodeVersion=process.version,this.installId=dt(t).replace(/-/g,""),this.traceFileKey=et(t),d.mkdirSync(t,{recursive:!0}),d.mkdirSync(this.failedDir,{recursive:!0}),f.info(`[telemetry] init: dir=${t}, failedDir=${this.failedDir}, cliVersion=${this.cliVersion}, os=${this.resolveOsName()}, arch=${this.resolveOsArch()}, node=${this.nodeVersion}`)}setStudioVersion(t){this.devecoStudioVersion=t,f.info(`[telemetry] studio version set: ${t}`)}setSourceType(t){this.sourceType=t,f.info(`[telemetry] sourceType set: ${t}`)}setCltVersion(t){this.cltVersion=t,f.info(`[telemetry] CLT version set: ${t}`)}async track(t,e){if(this.disabled)return typeof e=="function"?e():void 0;if(!this.storageDir)throw new Error("Telemetry not initialized. Call init() first.");if(!e){await this.record(t,0,!0,null);return}if(typeof e!="function"){let o=e;await this.record(t,o.duration_ms,o.success,o.error_code);return}let n=e,i=Date.now();try{let o=await n(),s=Date.now()-i;return await this.record(t,s,!0,null),o}catch(o){let s=Date.now()-i,p=this.toErrorCode(o);throw await this.record(t,s,!1,p),o}}async record(t,e,n,i){let o=this.buildTraceEvent(t,e,n,i);try{let s=$(JSON.stringify(o),this.traceFileKey);await d.promises.appendFile(this.currentFile(),s+`
|
|
3
|
+
`,"utf8"),lt(this.storageDir)}catch{}}buildTraceEvent(t,e,n,i){let o=`${r.EVENT_PREFIX}${t.event}`,s=Z.toObject(t);return s&&typeof s=="object"&&delete s.event,{countryCode:r.COUNTRY_CODE,event:o,eventtime:String(Date.now()),properties:{uid:this.installId,trace_uuid:mt.randomUUID(),trace_os_version:r.TRACE_OS_VERSION,os_arch:this.resolveOsArch(),action:o,trace_os_name:this.resolveOsName(),version:`${this.cliVersion}_${this.resolveOsSuffix()}`,deveco_studio_version:this.formatVersion(this.devecoStudioVersion),command_line_version:this.formatVersion(this.cltVersion),source_type:this.sourceType,session_id:this.sessionId,node_version:this.nodeVersion,duration_ms:e,success:n,error_code:i,event_detail:s}}}toErrorCode(t){return t instanceof Error?t.code??t.name:"UnknownError"}resolveOsArch(){let t=z.arch();return t==="x64"?"amd64":t}resolveOsName(){switch(process.platform){case"win32":{let t=z.release().split(".");return(parseInt(t[t.length-1],10)||0)>=22e3?"Windows 11":"Windows 10"}case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}}resolveOsSuffix(){switch(process.platform){case"win32":return"windows";case"darwin":return z.arch()==="arm64"?"mac_arm":"mac";default:return"linux"}}formatVersion(t){return t?`${t}_${this.resolveOsSuffix()}`:""}dateString(){let t=new Date,e=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${e}-${n}`}currentFile(){return y.join(this.storageDir,`telemetry-${this.dateString()}.txt`)}startScheduler(){if(this.stopScheduler(),this.disabled){f.info("[telemetry] scheduler not started (telemetry disabled)");return}f.info(`[telemetry] scheduler started (flush every ${k/1e3}s, retry failed every ${O/1e3}s)`),this.initialTimer=setTimeout(()=>{this.flush().catch(()=>{}),this.intervalTimer=setInterval(()=>{this.flush().catch(()=>{})},k)},k),this.retryInitialTimer=setTimeout(()=>{this.retryFailed().catch(()=>{}),this.retryTimer=setInterval(()=>{this.retryFailed().catch(()=>{})},O)},O)}stopScheduler(){this.initialTimer&&(clearTimeout(this.initialTimer),this.initialTimer=null),this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null),this.retryInitialTimer&&(clearTimeout(this.retryInitialTimer),this.retryInitialTimer=null),this.retryTimer&&(clearInterval(this.retryTimer),this.retryTimer=null),f.info("[telemetry] scheduler stopped")}async flush(){return this.disabled?!0:this.runExclusive(()=>this.performFlush())}async performFlush(){if(!this.storageDir)throw new Error("Telemetry not initialized. Call init() first.");let t=await this.listPendingFiles(),e=!0;for(let n of t)await this.flushFile(n)||(e=!1);return ct(this.storageDir),e}async retryFailed(){return this.disabled?!0:this.runExclusive(()=>this.performRetryFailed())}async performRetryFailed(){if(!this.storageDir)throw new Error("Telemetry not initialized. Call init() first.");let t=Date.now(),e;try{e=await d.promises.readdir(this.failedDir)}catch{return!0}let n=e.filter(o=>o.startsWith("telemetry-")&&o.endsWith(".txt")).map(o=>y.join(this.failedDir,o)),i=!0;for(let o of n){let s=y.basename(o),p=pt(s);if(p!==null){if(t-p>st){try{await d.promises.unlink(o)}catch{}continue}await this.flushFile(o)||(i=!1)}}return i||f.warn("[telemetry] retry failed"),ut(this.storageDir),i}runExclusive(t){let e=()=>t(),n=this.flushChain.then(e,e);return this.flushChain=n.then(()=>{},()=>{}),n}async listPendingFiles(){let t;try{t=await d.promises.readdir(this.storageDir)}catch{return[]}return t.filter(e=>e.startsWith("telemetry-")&&e.endsWith(".txt")).map(e=>y.join(this.storageDir,e)).sort()}async flushFile(t){let e=t+".pending";try{await d.promises.rename(t,e)}catch{return!1}let n;try{n=await d.promises.readFile(e,"utf8")}catch{return!1}let i=n.split(`
|
|
4
|
+
`).map(s=>s.trim()).filter(Boolean),o=[];for(let s of i){let p=rt(s,this.traceFileKey);p!==null&&o.push(p)}if(o.length===0){try{await d.promises.unlink(e)}catch{}return!0}return this.uploadInBatches(e,o)}async uploadInBatches(t,e){let n=0;for(;n<e.length;){let i=n,o=[],s=16;for(;n<e.length&&o.length<r.MAX_BATCH;){let h=e[n],w=Buffer.byteLength(h,"utf8")+1;if(o.length>0&&s+w>r.MAX_PAYLOAD_BYTES)break;o.push(h),s+=w,n++}let p=this.buildPayloadItems(o),l=JSON.stringify(p),v=!1;try{v=await this.uploader.upload(l,this.installId)}catch{}if(!v){f.warn("[telemetry] upload failed");let h=e.slice(i).join(`
|
|
5
|
+
`)+`
|
|
6
|
+
`;return await this.moveToFailed(t,h),!1}}try{await d.promises.unlink(t)}catch{}return!0}buildPayloadItems(t){let e=[];for(let n of t)try{let i=JSON.parse(n);e.push({action:i.event,detail:JSON.stringify(i.properties),timestamp:Number(i.eventtime)||Date.now()})}catch{}return e}async moveToFailed(t,e){let n=y.basename(t,".pending"),i=y.join(this.failedDir,n);try{let o=e.split(`
|
|
7
|
+
`).filter(Boolean).map(s=>$(s,this.traceFileKey)).join(`
|
|
8
|
+
`)+`
|
|
9
|
+
`;await d.promises.appendFile(i,o,"utf8")}catch{return}try{await d.promises.unlink(t)}catch{}}};var b=new T;import{spawn as Ve}from"child_process";import{existsSync as He}from"fs";import{dirname as Ke,join as We}from"path";import{fileURLToPath as Xe}from"url";var Mt=Nt.join(X(),"TraceLogData");b.init(Mt);(async()=>{try{await b.flush(),await b.retryFailed()}catch(r){f.warn("[telemetry] background upload error:",r),process.exit(1)}})();
|
package/docs.zip
ADDED
package/index.zip
ADDED
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deveco/deveco-cli-common",
|
|
3
|
+
"version": "1.3.4",
|
|
4
|
+
"description": "HarmonyOS application development command line tool",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"devecocli": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"scripts/postinstall.mjs",
|
|
13
|
+
"templates",
|
|
14
|
+
"src/resources",
|
|
15
|
+
"THIRD-PARTY-LICENSES",
|
|
16
|
+
"SKILL.md",
|
|
17
|
+
"docs.zip",
|
|
18
|
+
"index.zip"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"prepare": "husky",
|
|
22
|
+
"postinstall": "node scripts/postinstall.mjs",
|
|
23
|
+
"build": "tsup",
|
|
24
|
+
"build:index": "tsx index/build-index-bundle.ts",
|
|
25
|
+
"dev": "tsx watch src/cli.ts",
|
|
26
|
+
"start": "tsx src/cli.ts",
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"test:watch": "vitest",
|
|
29
|
+
"test:coverage": "vitest run --coverage",
|
|
30
|
+
"lint": "eslint src",
|
|
31
|
+
"lint:fix": "eslint src --fix",
|
|
32
|
+
"format": "prettier --write src",
|
|
33
|
+
"license": "generate-license-file --input package.json --output THIRD-PARTY-LICENSES --overwrite --ci",
|
|
34
|
+
"prepublishOnly": "npm run lint && npm run license && npm run build"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=22"
|
|
38
|
+
},
|
|
39
|
+
"os": [
|
|
40
|
+
"darwin",
|
|
41
|
+
"linux",
|
|
42
|
+
"win32"
|
|
43
|
+
],
|
|
44
|
+
"cpu": [
|
|
45
|
+
"x64",
|
|
46
|
+
"arm64"
|
|
47
|
+
],
|
|
48
|
+
"keywords": [
|
|
49
|
+
"harmonyos",
|
|
50
|
+
"deveco",
|
|
51
|
+
"cli"
|
|
52
|
+
],
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@eslint/js": "^10.0.1",
|
|
55
|
+
"@types/adm-zip": "^0.5.8",
|
|
56
|
+
"@types/fs-extra": "^11.0.4",
|
|
57
|
+
"@types/global-agent": "^3.0.0",
|
|
58
|
+
"@types/node": "^25.6.0",
|
|
59
|
+
"@types/node-forge": "^1.3.14",
|
|
60
|
+
"@types/proper-lockfile": "^4.1.4",
|
|
61
|
+
"@types/semver": "^7.7.1",
|
|
62
|
+
"@types/turndown": "^5.0.5",
|
|
63
|
+
"@types/yauzl": "^2.10.3",
|
|
64
|
+
"eslint": "^10.2.1",
|
|
65
|
+
"generate-license-file": "^4.2.1",
|
|
66
|
+
"husky": "^9.1.7",
|
|
67
|
+
"prettier": "^3.8.3",
|
|
68
|
+
"tsup": "^8.5.1",
|
|
69
|
+
"tsx": "^4.21.0",
|
|
70
|
+
"turndown": "^7.2.4",
|
|
71
|
+
"typescript": "^6.0.3",
|
|
72
|
+
"typescript-eslint": "^8.59.1",
|
|
73
|
+
"vitest": "^4.1.10"
|
|
74
|
+
},
|
|
75
|
+
"dependencies": {
|
|
76
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
77
|
+
"@sqlite.org/sqlite-wasm": "^3.49.1-build4",
|
|
78
|
+
"adm-zip": "0.6.1",
|
|
79
|
+
"axios": "1.19.0",
|
|
80
|
+
"colorette": "^2.0.20",
|
|
81
|
+
"commander": "^13.1.0",
|
|
82
|
+
"execa": "^9.6.1",
|
|
83
|
+
"fs-extra": "^11.3.4",
|
|
84
|
+
"global-agent": "^4.1.3",
|
|
85
|
+
"jieba-wasm": "^2.4.0",
|
|
86
|
+
"json5": "^2.2.3",
|
|
87
|
+
"mdast-util-to-string": "^4.0.0",
|
|
88
|
+
"node-forge": "^1.4.0",
|
|
89
|
+
"ora": "^9.4.0",
|
|
90
|
+
"p-limit": "^5.0.0",
|
|
91
|
+
"proper-lockfile": "^4.1.2",
|
|
92
|
+
"proxy-from-env": "^2.1.0",
|
|
93
|
+
"regedit": "^5.1.4",
|
|
94
|
+
"remark-gfm": "^4.0.1",
|
|
95
|
+
"remark-parse": "^11.0.0",
|
|
96
|
+
"semver": "^7.8.5",
|
|
97
|
+
"smol-toml": "^1.6.1",
|
|
98
|
+
"socket.io-client": "^4.7.5",
|
|
99
|
+
"unified": "^11.0.5",
|
|
100
|
+
"yauzl": "^3.2.0",
|
|
101
|
+
"zod": "^4.4.3"
|
|
102
|
+
},
|
|
103
|
+
"overrides": {
|
|
104
|
+
"dotenv": "16.4.7"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026 Huawei Device Co., Ltd.
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { spawn } from 'child_process';
|
|
7
|
+
import { existsSync } from 'fs';
|
|
8
|
+
import { dirname, join } from 'path';
|
|
9
|
+
import { fileURLToPath } from 'url';
|
|
10
|
+
|
|
11
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
12
|
+
const initScript = join(root, 'dist', 'internal', 'doc-init-background.js');
|
|
13
|
+
|
|
14
|
+
if (!existsSync(initScript)) {
|
|
15
|
+
process.exit(0);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const child = spawn(process.execPath, [initScript], {
|
|
19
|
+
detached: true,
|
|
20
|
+
stdio: ['ignore', 'ignore', 'ignore'],
|
|
21
|
+
env: {
|
|
22
|
+
...process.env,
|
|
23
|
+
DEVECO_CLI_SKIP_VERSION_CHECK: '1',
|
|
24
|
+
DEVECO_CLI_POSTINSTALL: '1',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
child.unref();
|
|
29
|
+
process.exit(0);
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"permissionName": "ohos.permission.SYSTEM_FLOAT_WINDOW",
|
|
4
|
+
"permissionDisplayName": "SYSTEM_FLOAT_WINDOW",
|
|
5
|
+
"permissionHelpUrlKey": "acl.system.float.window.instead.url",
|
|
6
|
+
"permissionInsteadName": "acl.SYSTEM_FLOAT_WINDOW.instead.name",
|
|
7
|
+
"minSupportApiLevel": "9"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"permissionName": "ohos.permission.READ_CONTACTS",
|
|
11
|
+
"permissionDisplayName": "READ_CONTACTS",
|
|
12
|
+
"permissionHelpUrlKey": "acl.read.contacts.instead.url",
|
|
13
|
+
"permissionInsteadName": "acl.READ_CONTACTS.instead.name",
|
|
14
|
+
"minSupportApiLevel": "8"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"permissionName": "ohos.permission.WRITE_CONTACTS",
|
|
18
|
+
"permissionDisplayName": "WRITE_CONTACTS",
|
|
19
|
+
"minSupportApiLevel": "8"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"permissionName": "ohos.permission.READ_IMAGEVIDEO",
|
|
23
|
+
"permissionDisplayName": "READ_IMAGEVIDEO",
|
|
24
|
+
"permissionHelpUrlKey": "acl.read.image.video.instead.url",
|
|
25
|
+
"permissionInsteadName": "acl.READ_IMAGEVIDEO.instead.name",
|
|
26
|
+
"minSupportApiLevel": "9"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"permissionName": "ohos.permission.WRITE_IMAGEVIDEO",
|
|
30
|
+
"permissionDisplayName": "WRITE_IMAGEVIDEO",
|
|
31
|
+
"permissionHelpUrlKey": "acl.write.image.video.instead.url",
|
|
32
|
+
"permissionInsteadName": "acl.WRITE_IMAGEVIDEO.instead.name",
|
|
33
|
+
"minSupportApiLevel": "9"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"permissionName": "ohos.permission.READ_AUDIO",
|
|
37
|
+
"permissionDisplayName": "READ_AUDIO",
|
|
38
|
+
"permissionHelpUrlKey": "acl.read.audio.instead.url",
|
|
39
|
+
"permissionInsteadName": "acl.READ_AUDIO.instead.name",
|
|
40
|
+
"minSupportApiLevel": "9"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"permissionName": "ohos.permission.WRITE_AUDIO",
|
|
44
|
+
"permissionDisplayName": "WRITE_AUDIO",
|
|
45
|
+
"permissionHelpUrlKey": "acl.write.audio.instead.url",
|
|
46
|
+
"permissionInsteadName": "acl.WRITE_AUDIO.instead.name",
|
|
47
|
+
"minSupportApiLevel": "9"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"permissionName": "ohos.permission.READ_PASTEBOARD",
|
|
51
|
+
"permissionDisplayName": "READ_PASTEBOARD",
|
|
52
|
+
"permissionHelpUrlKey": "acl.read.pasteboard.instead.url",
|
|
53
|
+
"permissionInsteadName": "acl.READ_PASTEBOARD.instead.name",
|
|
54
|
+
"minSupportApiLevel": "11"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"permissionName": "ohos.permission.ACCESS_DDK_USB",
|
|
58
|
+
"permissionDisplayName": "ACCESS_DDK_USB",
|
|
59
|
+
"minSupportApiLevel": "11"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"permissionName": "ohos.permission.ACCESS_DDK_HID",
|
|
63
|
+
"permissionDisplayName": "ACCESS_DDK_HID",
|
|
64
|
+
"minSupportApiLevel": "11"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"permissionName": "ohos.permission.FILE_ACCESS_PERSIST",
|
|
68
|
+
"permissionDisplayName": "FILE_ACCESS_PERSIST",
|
|
69
|
+
"minSupportApiLevel": "11"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"permissionName": "ohos.permission.READ_WRITE_DOWNLOAD_DIRECTORY",
|
|
73
|
+
"permissionDisplayName": "READ_WRITE_DOWNLOAD_DIRECTORY",
|
|
74
|
+
"minSupportApiLevel": "11"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"permissionName": "ohos.permission.READ_WRITE_DESKTOP_DIRECTORY",
|
|
78
|
+
"permissionDisplayName": "READ_WRITE_DESKTOP_DIRECTORY",
|
|
79
|
+
"minSupportApiLevel": "11"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"permissionName": "ohos.permission.READ_WRITE_DOCUMENTS_DIRECTORY",
|
|
83
|
+
"permissionDisplayName": "READ_WRITE_DOCUMENTS_DIRECTORY",
|
|
84
|
+
"minSupportApiLevel": "11"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"permissionName": "ohos.permission.INPUT_MONITORING",
|
|
88
|
+
"permissionDisplayName": "INPUT_MONITORING",
|
|
89
|
+
"minSupportApiLevel": "12"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"permissionName": "ohos.permission.INTERCEPT_INPUT_EVENT",
|
|
93
|
+
"permissionDisplayName": "INTERCEPT_INPUT_EVENT",
|
|
94
|
+
"minSupportApiLevel": "12"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"permissionName": "ohos.permission.SHORT_TERM_WRITE_IMAGEVIDEO",
|
|
98
|
+
"permissionDisplayName": "SHORT_TERM_WRITE_IMAGEVIDEO",
|
|
99
|
+
"minSupportApiLevel": "12"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"permissionName": "ohos.permission.kernel.ALLOW_WRITABLE_CODE_MEMORY",
|
|
103
|
+
"permissionDisplayName": "ALLOW_WRITABLE_CODE_MEMORY",
|
|
104
|
+
"minSupportApiLevel": "14"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"permissionName": "ohos.permission.kernel.DISABLE_CODE_MEMORY_PROTECTION",
|
|
108
|
+
"permissionDisplayName": "DISABLE_CODE_MEMORY_PROTECTION",
|
|
109
|
+
"minSupportApiLevel": "14"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"permissionName": "ohos.permission.kernel.ALLOW_EXECUTABLE_FORT_MEMORY",
|
|
113
|
+
"permissionDisplayName": "ALLOW_EXECUTABLE_FORT_MEMORY",
|
|
114
|
+
"minSupportApiLevel": "14"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"permissionName": "ohos.permission.GET_WIFI_PEERS_MAC",
|
|
118
|
+
"permissionDisplayName": "GET_WIFI_PEERS_MAC",
|
|
119
|
+
"minSupportApiLevel": "8"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"permissionName": "ohos.permission.MANAGE_PASTEBOARD_APP_SHARE_OPTION",
|
|
123
|
+
"permissionDisplayName": "MANAGE_PASTEBOARD_APP_SHARE_OPTION",
|
|
124
|
+
"minSupportApiLevel": "14"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"permissionName": "ohos.permission.MANAGE_UDMF_APP_SHARE_OPTION",
|
|
128
|
+
"permissionDisplayName": "MANAGE_UDMF_APP_SHARE_OPTION",
|
|
129
|
+
"minSupportApiLevel": "14"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"permissionName": "ohos.permission.READ_WRITE_USER_FILE",
|
|
133
|
+
"permissionDisplayName": "READ_WRITE_USER_FILE",
|
|
134
|
+
"minSupportApiLevel": "13"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"permissionName": "ohos.permission.READ_WRITE_USB_DEV",
|
|
138
|
+
"permissionDisplayName": "READ_WRITE_USB_DEV",
|
|
139
|
+
"minSupportApiLevel": "13"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"permissionName": "ohos.permission.USE_FRAUD_CALL_LOG_PICKER",
|
|
143
|
+
"permissionDisplayName": "USE_FRAUD_CALL_LOG_PICKER",
|
|
144
|
+
"minSupportApiLevel": "15"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"permissionName": "ohos.permission.USE_FRAUD_MESSAGES_PICKER",
|
|
148
|
+
"permissionDisplayName": "USE_FRAUD_MESSAGES_PICKER",
|
|
149
|
+
"minSupportApiLevel": "15"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"permissionName": "ohos.permission.ACCESS_DISK_PHY_INFO",
|
|
153
|
+
"permissionDisplayName": "ACCESS_DISK_PHY_INFO",
|
|
154
|
+
"minSupportApiLevel": "15"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"permissionName": "ohos.permission.SET_PAC_URL",
|
|
158
|
+
"permissionDisplayName": "SET_PAC_URL",
|
|
159
|
+
"minSupportApiLevel": "15"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"permissionName": "ohos.permission.PERSONAL_MANAGE_RESTRICTIONS",
|
|
163
|
+
"permissionDisplayName": "PERSONAL_MANAGE_RESTRICTIONS",
|
|
164
|
+
"minSupportApiLevel": "15"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"permissionName": "ohos.permission.START_PROVISIONING_MESSAGE",
|
|
168
|
+
"permissionDisplayName": "START_PROVISIONING_MESSAGE",
|
|
169
|
+
"minSupportApiLevel": "15"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"permissionName": "ohos.permission.PRELOAD_FILE",
|
|
173
|
+
"permissionDisplayName": "PRELOAD_FILE",
|
|
174
|
+
"minSupportApiLevel": "15"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"permissionName": "ohos.permission.ACCESS_VIRTUAL_SCREEN",
|
|
178
|
+
"permissionDisplayName": "ACCESS_VIRTUAL_SCREEN",
|
|
179
|
+
"minSupportApiLevel": "16"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"permissionName": "ohos.permission.PERSISTENT_BLUETOOTH_PEERS_MAC",
|
|
183
|
+
"permissionDisplayName": "PERSISTENT_BLUETOOTH_PEERS_MAC",
|
|
184
|
+
"minSupportApiLevel": "16"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"permissionName": "ohos.permission.ACCESS_DDK_USB_SERIAL",
|
|
188
|
+
"permissionDisplayName": "ACCESS_DDK_USB_SERIAL",
|
|
189
|
+
"minSupportApiLevel": "18"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"permissionName": "ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL",
|
|
193
|
+
"permissionDisplayName": "ACCESS_DDK_SCSI_PERIPHERAL",
|
|
194
|
+
"minSupportApiLevel": "18"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"permissionName": "ohos.permission.USE_FRAUD_APP_PICKER",
|
|
198
|
+
"permissionDisplayName": "USE_FRAUD_APP_PICKER",
|
|
199
|
+
"minSupportApiLevel": "18"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"permissionName": "ohos.permission.kernel.DISABLE_GOTPLT_RO_PROTECTION",
|
|
203
|
+
"permissionDisplayName": "DISABLE_GOTPLT_RO_PROTECTION",
|
|
204
|
+
"minSupportApiLevel": "17"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"permissionName": "ohos.permission.MANAGE_APN_SETTING",
|
|
208
|
+
"permissionDisplayName": "MANAGE_APN_SETTING",
|
|
209
|
+
"minSupportApiLevel": "16"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"permissionName": "ohos.permission.MANAGE_SCREEN_TIME_GUARD",
|
|
213
|
+
"permissionDisplayName": "MANAGE_SCREEN_TIME_GUARD",
|
|
214
|
+
"minSupportApiLevel": "20"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"permissionName": "ohos.permission.CUSTOMIZE_SAVE_BUTTON",
|
|
218
|
+
"permissionDisplayName": "CUSTOMIZE_SAVE_BUTTON",
|
|
219
|
+
"minSupportApiLevel": "20"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"permissionName": "ohos.permission.GET_ABILITY_INFO",
|
|
223
|
+
"permissionDisplayName": "GET_ABILITY_INFO",
|
|
224
|
+
"minSupportApiLevel": "20"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"permissionName": "ohos.permission.DLP_GET_HIDE_STATUS",
|
|
228
|
+
"permissionDisplayName": "DLP_GET_HIDE_STATUS",
|
|
229
|
+
"minSupportApiLevel": "20"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"permissionName": "ohos.permission.ACCESS_FIDO2_ONLINEAUTH",
|
|
233
|
+
"permissionDisplayName": "ACCESS_FIDO2_ONLINEAUTH",
|
|
234
|
+
"minSupportApiLevel": "20"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"permissionName": "ohos.permission.LINKTURBO",
|
|
238
|
+
"permissionDisplayName": "LINKTURBO",
|
|
239
|
+
"minSupportApiLevel": "20"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"permissionName": "ohos.permission.USE_FLOAT_BALL",
|
|
243
|
+
"permissionDisplayName": "USE_FLOAT_BALL",
|
|
244
|
+
"minSupportApiLevel": "20"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"permissionName": "ohos.permission.GET_ETHERNET_LOCAL_MAC",
|
|
248
|
+
"permissionDisplayName": "GET_ETHERNET_LOCAL_MAC",
|
|
249
|
+
"minSupportApiLevel": "20"
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"permissionName": "ohos.permission.GET_WIFI_LOCAL_MAC",
|
|
253
|
+
"permissionDisplayName": "GET_WIFI_LOCAL_MAC",
|
|
254
|
+
"minSupportApiLevel": "20"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"permissionName": "ohos.permission.READ_LOCAL_DEVICE_NAME",
|
|
258
|
+
"permissionDisplayName": "READ_LOCAL_DEVICE_NAME",
|
|
259
|
+
"minSupportApiLevel": "20"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"permissionName": "ohos.permission.ACCESS_NET_TRACE_INFO",
|
|
263
|
+
"permissionDisplayName": "ACCESS_NET_TRACE_INFO",
|
|
264
|
+
"minSupportApiLevel": "20"
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"permissionName": "ohos.permission.KEEP_BACKGROUND_RUNNING_SYSTEM",
|
|
268
|
+
"permissionDisplayName": "KEEP_BACKGROUND_RUNNING_SYSTEM",
|
|
269
|
+
"minSupportApiLevel": "20"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"permissionName": "ohos.permission.atomicService.MANAGE_STORAGE",
|
|
273
|
+
"permissionDisplayName": "MANAGE_STORAGE",
|
|
274
|
+
"minSupportApiLevel": "20"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"permissionName": "ohos.permission.WEB_NATIVE_MESSAGING",
|
|
278
|
+
"permissionDisplayName": "WEB_NATIVE_MESSAGING",
|
|
279
|
+
"minSupportApiLevel": "21"
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"permissionName": "ohos.permission.HOOK_KEY_EVENT",
|
|
283
|
+
"permissionDisplayName": "HOOK_KEY_EVENT",
|
|
284
|
+
"minSupportApiLevel": "21"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"permissionName": "ohos.permission.SET_SYSTEMSHARE_APPLAUNCHTRUSTLIST",
|
|
288
|
+
"permissionDisplayName": "SET_SYSTEMSHARE_APPLAUNCHTRUSTLIST",
|
|
289
|
+
"minSupportApiLevel": "21"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"permissionName": "ohos.permission.SUBSCRIBE_NOTIFICATION",
|
|
293
|
+
"permissionDisplayName": "SUBSCRIBE_NOTIFICATION",
|
|
294
|
+
"minSupportApiLevel": "22"
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"permissionName": "ohos.permission.ACCESS_USER_FULL_DISK",
|
|
298
|
+
"permissionDisplayName": "ACCESS_USER_FULL_DISK",
|
|
299
|
+
"minSupportApiLevel": "22"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"permissionName": "ohos.permission.CUSTOM_SCREEN_RECORDING",
|
|
303
|
+
"permissionDisplayName": "CUSTOM_SCREEN_RECORDING",
|
|
304
|
+
"minSupportApiLevel": "22"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"permissionName": "ohos.permission.GET_IP_MAC_INFO",
|
|
308
|
+
"permissionDisplayName": "GET_IP_MAC_INFO",
|
|
309
|
+
"minSupportApiLevel": "22"
|
|
310
|
+
}
|
|
311
|
+
]
|