nemar-cli 0.8.14-PR468.bee3faa → 0.8.14-PR469.9a8e13e
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 +8 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -95,7 +95,7 @@ ${W.dim(`eta: ${D.eta}`)}`:"";process.stderr.write(`${F}
|
|
|
95
95
|
${$} ${D.message}
|
|
96
96
|
${J}${Q}
|
|
97
97
|
${F}
|
|
98
|
-
`)}var Ef=!1;var NW=P(()=>{xD()});var Zf;var Vf=P(()=>{Zf={name:"nemar-cli",version:"0.8.14-PR468.bee3faa",description:"CLI for NEMAR (Neuroelectromagnetic Data Archive and Tools Resource) dataset management",type:"module",main:"dist/index.js",bin:{nemar:"dist/index.js"},scripts:{dev:"bun run src/index.ts",build:"bun build src/index.ts --outdir dist --target bun --minify && sed '1s|#!/usr/bin/env node|#!/usr/bin/env bun|' dist/index.js > dist/index.js.tmp && mv dist/index.js.tmp dist/index.js",test:"bun test",lint:"biome check src/","lint:fix":"biome check --fix src/",format:"biome format --write src/",typecheck:"tsc --noEmit",prepublishOnly:"bun run build","docs:generate":"bun run scripts/generate-docs.ts","docs:serve":"mkdocs serve","docs:build":"mkdocs build",prepare:"husky",deploy:"wrangler deploy",preview:"wrangler dev"},keywords:["nemar","bids","neuroimaging","eeg","emg","datalad","cli"],author:"NEMAR Team",license:"CC-BY-NC-ND-4.0",repository:{type:"git",url:"git+https://github.com/nemarOrg/nemar-cli.git"},bugs:{url:"https://github.com/nemarOrg/nemar-cli/issues"},homepage:"https://nemar-cli.pages.dev",engines:{bun:">=1.0.0"},files:["dist","README.md","LICENSE"],dependencies:{chalk:"^5.3.0",commander:"^12.1.0",conf:"^13.0.1","fuse.js":"^7.1.0",inquirer:"^9.2.15",ora:"^8.0.1",zod:"^3.23.8"},"lint-staged":{"src/**/*.{ts,tsx}":["biome check --fix"],"backend/src/**/*.{ts,tsx}":["biome check --fix"]},devDependencies:{"@biomejs/biome":"1.9.4","@types/bcryptjs":"^3.0.0","@types/bun":"latest","@types/inquirer":"^9.0.7",bcryptjs:"^3.0.3",husky:"^9.1.7","lint-staged":"^16.3.2",typescript:"^5.5.4",wrangler:"^4.70.0",yaml:"^2.8.4"}}});var _4;var oJ=P(()=>{Vf();_4=Zf.version});function w0(D){if(D instanceof Error)return D.message;return String(D)}function Uf(){if(process.env.TEST_API_URL)return process.env.TEST_API_URL;if(RW)return CW;return JD().apiUrl||CW}async function b(D,F={},$=!1){let J=`${Uf()}${D}`,Q={"Content-Type":"application/json","X-CLI-Version":_4,...F.headers};if($){let X=JD();if(!X.apiKey&&$===!0)throw new p(401,"Not authenticated. Run 'nemar auth login' first.");if(X.apiKey)Q.Authorization=`Bearer ${X.apiKey}`}let Y;try{Y=await fetch(J,{...F,headers:Q})}catch(X){throw new p(0,`Network error: Could not connect to ${Uf()}`,{originalError:X instanceof Error?X.message:String(X)})}let B;try{B=await Y.json()}catch{throw new p(Y.status,`Invalid response from server (status ${Y.status})`)}if(!Y.ok){if(Y.status===503&&(B.mode==="read-only"||B.mode==="full")){let X=typeof B.message==="string"?B.message:"NEMAR is in maintenance mode. Please retry shortly.",G=typeof B.eta==="string"?B.eta:null,H=new rJ(B.mode,X,G,B.details);throw aJ(H),H}throw new p(Y.status,B.error||B.message||"Request failed",B.details,typeof B.step==="string"?B.step:void 0)}return B}async function Af(D){return b(`/auth/check-username?username=${encodeURIComponent(D)}`)}async function Mf(D){return b(`/auth/check-github?username=${encodeURIComponent(D)}`)}async function Nf(D){return b("/auth/signup",{method:"POST",body:JSON.stringify(D)})}async function Cf(D){return b("/auth/login",{method:"POST",body:JSON.stringify({api_key:D})})}async function Rf(D){return b("/auth/resend-verification",{method:"POST",body:JSON.stringify({email:D})})}async function Of(D,F){return b("/auth/retrieve-key",{method:"POST",body:JSON.stringify({email:D,password:F})})}async function wf(D){return b("/auth/request-key-regeneration",{method:"POST",body:JSON.stringify({email:D})})}async function tJ(){return b("/users/me",{},!0)}async function Tf(D,F){let $=new URLSearchParams;if(D)$.set("status",D);if(F)$.set("role",F);let J=$.toString()?`?${$.toString()}`:"";return b(`/admin/users${J}`,{},!0)}async function jf(D){return b(`/admin/approve/${D}`,{method:"POST"},!0)}async function Pf(D){return b(`/admin/revoke/${D}`,{method:"POST"},!0)}async function If(D,F){return b(`/admin/users/${D}/role`,{method:"POST",body:JSON.stringify({role:F})},!0)}async function OW(D,F){return b(`/admin/datasets/${D}/visibility`,{method:"PATCH",body:JSON.stringify({visibility:F})},!0)}async function Sf(D){return b(`/datasets/${D}/publish`,{method:"POST"},!0)}async function kf(D){return b(`/admin/datasets/${D}/ci`,{},!0)}async function f4(D){return b(`/admin/datasets/${D}/ci`,{method:"POST"},!0)}async function wW(D){return b(`/admin/datasets/${D}/ci/sync`,{method:"POST"},!0)}async function eJ(D){return b(`/datasets/${D}/ci/status`,{},!0)}async function vf(D){return b(`/datasets/${D}/manifest`,{},!0)}async function DQ(D,F){return b(`/datasets/${D}/manifest/${F}`,{},!0)}function yf(D){let F=D;if(!F.status)F.status="active";else if(!["active","archived","deleted"].includes(F.status))throw Error(`Invalid dataset status: ${F.status}`);if(!F.visibility)F.visibility="private";else if(!["public","private"].includes(F.visibility))throw Error(`Invalid dataset visibility: ${F.visibility}`);return F}async function I9(D={}){let F=new URLSearchParams;if(D.mine)F.set("mine","true");if(D.search)F.set("search",D.search);if(D.modality)F.set("modality",D.modality);if(D.author)F.set("author",D.author);if(D.task)F.set("task",D.task);if(D.hasDoi)F.set("has_doi","true");if(D.recent)F.set("recent",String(D.recent));if(D.sort)F.set("sort",D.sort);if(D.limit!=null)F.set("limit",String(D.limit));if(D.offset!=null)F.set("offset",String(D.offset));if(D.owner)F.set("owner",D.owner);let $=F.toString()?`?${F.toString()}`:"",J=await b(`/datasets${$}`,{},D.mine?!0:"optional");return J.datasets=J.datasets.map(yf),J}async function xf(D){return b(`/datasets/resolve/${D}`,{},"optional")}async function _f(D,F={}){let $=new URLSearchParams({q:D});if(F.modality)$.set("modality",F.modality);if(F.limit)$.set("limit",String(F.limit));return b(`/datasets/search?${$.toString()}`,{},"optional")}async function uD(D){let F=await b(`/datasets/${D}`,{},"optional");return yf(F.dataset)}async function ff(D){return b(`/datasets/${D}/versions`,{},!0)}async function FQ(D){return b("/datasets",{method:"POST",body:JSON.stringify(D)},!0)}async function $Q(D){return b(`/datasets/${D}/finalize`,{method:"POST"},!0)}async function R8(D,F){return b(`/datasets/${D}/upload-credentials`,{method:"POST",body:JSON.stringify({duration_seconds:F})},!0)}async function JQ(D,F){return b(`/datasets/${D}/download-credentials`,{method:"POST",body:JSON.stringify({duration_seconds:F})},!0)}async function gf(D,F){return b(`/admin/datasets/${D}/doi/concept`,{method:"POST",body:JSON.stringify(F)},!0)}async function S9(D){return b(`/admin/datasets/${D}/doi`,{},!0)}async function TW(D,F){return b(`/admin/datasets/${D}/doi/update`,{method:"POST",body:JSON.stringify(F)},!0)}async function jW(D){return b(`/datasets/${D}/request-access`,{method:"POST"},!0)}async function hf(D,F){return b(`/datasets/${D}/invite`,{method:"POST",body:JSON.stringify({username:F})},!0)}async function bf(D){return b(`/datasets/${D}/collaborators`,{},!0)}async function uf(D){return b("/sandbox/complete",{method:"POST",body:JSON.stringify({dataset_id:D})},!0)}async function mf(){return b("/sandbox/reset",{method:"POST"},!0)}async function lf(){return b("/sandbox/status",{},!0)}async function QQ(D){return b(`/datasets/${D}/publish/request`,{method:"POST"},!0)}async function pf(D){return b(`/datasets/${D}/publish/status`,{},!0)}async function df(D){return b(`/datasets/${D}/publish/resend`,{method:"POST"},!0)}async function cf(D){let F=D?`?status=${D}`:"";return b(`/admin/publish/requests${F}`,{},!0)}async function nf(D,F){return b(`/admin/publish/${D}/deny`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:F})},!0)}function az0(D){if(!(D instanceof p))return!1;if(D.statusCode===0)return!0;if(D.statusCode===429)return!0;if(D.statusCode>=500&&D.statusCode<600)return!0;if(D.statusCode===403&&/repository has been locked/i.test(D.message))return!0;return!1}async function YQ(D,F=!1,$=!1,J=!1,Q){let X,G=F,H=[],q;for(let K=1;K<=5;K++)try{let V,E=!0;do{if(V=await b(`/admin/publish/${D}/approve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resume:E?G:!0,sandbox:$,s3_lock_continuation_token:X,skip_ci_check:J})},!0),E=!1,V.step_results)H.push(...V.step_results);if(V.hasMore&&V.s3_lock_continuation_token!==void 0)X=V.s3_lock_continuation_token;else break}while(V.hasMore);if(H.length>0)V.step_results=Lf(H);return V}catch(V){if(q=V,K===5||!az0(V)){if(V instanceof p&&H.length>0)V.stepResults=Lf(H);throw V}let Z=V;Q?.({attempt:K,maxAttempts:5,delayMs:1e4,step:Z.step,error:Z.message}),await new Promise((L)=>setTimeout(L,1e4)),G=!0}throw q}function Lf(D){let F=new Map;for(let $ of D)F.set($.step,$);return Array.from(F.values())}async function af(D,F){return b(`/admin/datasets/${D}/enrichment`,{method:"POST",body:JSON.stringify(F)},!0)}async function of(D){return b(`/admin/datasets/${D}/files`,{},!0)}async function sf(D){let F,$=0,J=[],Q=!0;while(Q){let Y=await b(`/admin/datasets/${D}/s3-lock`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({continuation_token:F})},!0);if($+=Y.locked,Y.failed?.length)J.push(...Y.failed);if(Q=Y.hasMore,F=Y.continuation_token,Q&&!F)throw new p(500,"S3 lock paginated response missing continuation_token; aborting to avoid infinite loop")}return{locked:$,failed:J}}async function rf(D){return b(`/admin/datasets/${D}/reset`,{method:"POST"},!0)}async function tf(D,F=!1){return b(`/admin/datasets/${D}`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({force:F})},!0)}async function ef(D){return b("/admin/datasets/bulk-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataset_ids:D})},!0)}async function Dg(D){return b("/admin/datasets/import",{method:"POST",body:JSON.stringify(D)},!0)}async function Fg(D){return b(`/admin/datasets/${D}/sync`,{method:"POST"},!0)}async function $g(){return b("/admin/sync/status",{},!0)}async function Jg(D,F){return b(`/admin/datasets/${D}/reindex`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F??{})},!0)}async function Qg(D,F){return b("/admin/datasets/reindex/bulk",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filter:D,...F??{}})},!0)}async function Yg(){return b("/admin/email-preferences",{},!0)}async function Bg(D){return b("/admin/email-preferences",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(D)},!0)}async function Xg(){return b("/notices",{},"optional")}async function Gg(){return b("/admin/notices",{},!0)}async function Wg(D){return b("/admin/notices",{method:"POST",body:JSON.stringify(D)},!0)}async function Hg(D){return b(`/admin/notices/${D}`,{method:"DELETE"},!0)}async function PW(D){return b("/admin/notify",{method:"POST",body:JSON.stringify(D)},!0)}var CW="https://api.nemar.org",sJ,p,rJ,RW;var i8=P(()=>{x4();NW();oJ();sJ=/^\d{4}-\d{4}-\d{4}-\d{3}[\dX]$/;p=class p extends Error{statusCode;details;step;constructor(D,F,$,J){super(F);this.statusCode=D;this.details=$;this.step=J;this.name="ApiError"}};rJ=class rJ extends p{mode;eta;constructor(D,F,$,J){super(503,F,J);this.mode=D;this.eta=$;this.name="MaintenanceError"}};RW=CW.includes("workers.dev")});function Kg(D){IW=D}function SW(){return IW}function k9(D){if(IW)process.stderr.write(`${D}
|
|
98
|
+
`)}var Ef=!1;var NW=P(()=>{xD()});var Zf;var Vf=P(()=>{Zf={name:"nemar-cli",version:"0.8.14-PR469.9a8e13e",description:"CLI for NEMAR (Neuroelectromagnetic Data Archive and Tools Resource) dataset management",type:"module",main:"dist/index.js",bin:{nemar:"dist/index.js"},scripts:{dev:"bun run src/index.ts",build:"bun build src/index.ts --outdir dist --target bun --minify && sed '1s|#!/usr/bin/env node|#!/usr/bin/env bun|' dist/index.js > dist/index.js.tmp && mv dist/index.js.tmp dist/index.js",test:"bun test",lint:"biome check src/","lint:fix":"biome check --fix src/",format:"biome format --write src/",typecheck:"tsc --noEmit",prepublishOnly:"bun run build","docs:generate":"bun run scripts/generate-docs.ts","docs:serve":"mkdocs serve","docs:build":"mkdocs build",prepare:"husky",deploy:"wrangler deploy",preview:"wrangler dev"},keywords:["nemar","bids","neuroimaging","eeg","emg","datalad","cli"],author:"NEMAR Team",license:"CC-BY-NC-ND-4.0",repository:{type:"git",url:"git+https://github.com/nemarOrg/nemar-cli.git"},bugs:{url:"https://github.com/nemarOrg/nemar-cli/issues"},homepage:"https://nemar-cli.pages.dev",engines:{bun:">=1.0.0"},files:["dist","README.md","LICENSE"],dependencies:{chalk:"^5.3.0",commander:"^12.1.0",conf:"^13.0.1","fuse.js":"^7.1.0",inquirer:"^9.2.15",ora:"^8.0.1",zod:"^3.23.8"},"lint-staged":{"src/**/*.{ts,tsx}":["biome check --fix"],"backend/src/**/*.{ts,tsx}":["biome check --fix"]},devDependencies:{"@biomejs/biome":"1.9.4","@types/bcryptjs":"^3.0.0","@types/bun":"latest","@types/inquirer":"^9.0.7",bcryptjs:"^3.0.3",husky:"^9.1.7","lint-staged":"^16.3.2",typescript:"^5.5.4",wrangler:"^4.70.0",yaml:"^2.8.4"}}});var _4;var oJ=P(()=>{Vf();_4=Zf.version});function w0(D){if(D instanceof Error)return D.message;return String(D)}function Uf(){if(process.env.TEST_API_URL)return process.env.TEST_API_URL;if(RW)return CW;return JD().apiUrl||CW}async function b(D,F={},$=!1){let J=`${Uf()}${D}`,Q={"Content-Type":"application/json","X-CLI-Version":_4,...F.headers};if($){let X=JD();if(!X.apiKey&&$===!0)throw new p(401,"Not authenticated. Run 'nemar auth login' first.");if(X.apiKey)Q.Authorization=`Bearer ${X.apiKey}`}let Y;try{Y=await fetch(J,{...F,headers:Q})}catch(X){throw new p(0,`Network error: Could not connect to ${Uf()}`,{originalError:X instanceof Error?X.message:String(X)})}let B;try{B=await Y.json()}catch{throw new p(Y.status,`Invalid response from server (status ${Y.status})`)}if(!Y.ok){if(Y.status===503&&(B.mode==="read-only"||B.mode==="full")){let X=typeof B.message==="string"?B.message:"NEMAR is in maintenance mode. Please retry shortly.",G=typeof B.eta==="string"?B.eta:null,H=new rJ(B.mode,X,G,B.details);throw aJ(H),H}throw new p(Y.status,B.error||B.message||"Request failed",B.details,typeof B.step==="string"?B.step:void 0)}return B}async function Af(D){return b(`/auth/check-username?username=${encodeURIComponent(D)}`)}async function Mf(D){return b(`/auth/check-github?username=${encodeURIComponent(D)}`)}async function Nf(D){return b("/auth/signup",{method:"POST",body:JSON.stringify(D)})}async function Cf(D){return b("/auth/login",{method:"POST",body:JSON.stringify({api_key:D})})}async function Rf(D){return b("/auth/resend-verification",{method:"POST",body:JSON.stringify({email:D})})}async function Of(D,F){return b("/auth/retrieve-key",{method:"POST",body:JSON.stringify({email:D,password:F})})}async function wf(D){return b("/auth/request-key-regeneration",{method:"POST",body:JSON.stringify({email:D})})}async function tJ(){return b("/users/me",{},!0)}async function Tf(D,F){let $=new URLSearchParams;if(D)$.set("status",D);if(F)$.set("role",F);let J=$.toString()?`?${$.toString()}`:"";return b(`/admin/users${J}`,{},!0)}async function jf(D){return b(`/admin/approve/${D}`,{method:"POST"},!0)}async function Pf(D){return b(`/admin/revoke/${D}`,{method:"POST"},!0)}async function If(D,F){return b(`/admin/users/${D}/role`,{method:"POST",body:JSON.stringify({role:F})},!0)}async function OW(D,F){return b(`/admin/datasets/${D}/visibility`,{method:"PATCH",body:JSON.stringify({visibility:F})},!0)}async function Sf(D){return b(`/datasets/${D}/publish`,{method:"POST"},!0)}async function kf(D){return b(`/admin/datasets/${D}/ci`,{},!0)}async function f4(D,F){let $=F?.validate===!1?"?validate=false":"";return b(`/admin/datasets/${D}/ci${$}`,{method:"POST"},!0)}async function wW(D){return b(`/admin/datasets/${D}/ci/sync`,{method:"POST"},!0)}async function eJ(D){return b(`/datasets/${D}/ci/status`,{},!0)}async function vf(D){return b(`/datasets/${D}/manifest`,{},!0)}async function DQ(D,F){return b(`/datasets/${D}/manifest/${F}`,{},!0)}function yf(D){let F=D;if(!F.status)F.status="active";else if(!["active","archived","deleted"].includes(F.status))throw Error(`Invalid dataset status: ${F.status}`);if(!F.visibility)F.visibility="private";else if(!["public","private"].includes(F.visibility))throw Error(`Invalid dataset visibility: ${F.visibility}`);return F}async function I9(D={}){let F=new URLSearchParams;if(D.mine)F.set("mine","true");if(D.search)F.set("search",D.search);if(D.modality)F.set("modality",D.modality);if(D.author)F.set("author",D.author);if(D.task)F.set("task",D.task);if(D.hasDoi)F.set("has_doi","true");if(D.recent)F.set("recent",String(D.recent));if(D.sort)F.set("sort",D.sort);if(D.limit!=null)F.set("limit",String(D.limit));if(D.offset!=null)F.set("offset",String(D.offset));if(D.owner)F.set("owner",D.owner);let $=F.toString()?`?${F.toString()}`:"",J=await b(`/datasets${$}`,{},D.mine?!0:"optional");return J.datasets=J.datasets.map(yf),J}async function xf(D){return b(`/datasets/resolve/${D}`,{},"optional")}async function _f(D,F={}){let $=new URLSearchParams({q:D});if(F.modality)$.set("modality",F.modality);if(F.limit)$.set("limit",String(F.limit));return b(`/datasets/search?${$.toString()}`,{},"optional")}async function uD(D){let F=await b(`/datasets/${D}`,{},"optional");return yf(F.dataset)}async function ff(D){return b(`/datasets/${D}/versions`,{},!0)}async function FQ(D){return b("/datasets",{method:"POST",body:JSON.stringify(D)},!0)}async function $Q(D){return b(`/datasets/${D}/finalize`,{method:"POST"},!0)}async function R8(D,F){return b(`/datasets/${D}/upload-credentials`,{method:"POST",body:JSON.stringify({duration_seconds:F})},!0)}async function JQ(D,F){return b(`/datasets/${D}/download-credentials`,{method:"POST",body:JSON.stringify({duration_seconds:F})},!0)}async function gf(D,F){return b(`/admin/datasets/${D}/doi/concept`,{method:"POST",body:JSON.stringify(F)},!0)}async function S9(D){return b(`/admin/datasets/${D}/doi`,{},!0)}async function TW(D,F){return b(`/admin/datasets/${D}/doi/update`,{method:"POST",body:JSON.stringify(F)},!0)}async function jW(D){return b(`/datasets/${D}/request-access`,{method:"POST"},!0)}async function hf(D,F){return b(`/datasets/${D}/invite`,{method:"POST",body:JSON.stringify({username:F})},!0)}async function bf(D){return b(`/datasets/${D}/collaborators`,{},!0)}async function uf(D){return b("/sandbox/complete",{method:"POST",body:JSON.stringify({dataset_id:D})},!0)}async function mf(){return b("/sandbox/reset",{method:"POST"},!0)}async function lf(){return b("/sandbox/status",{},!0)}async function QQ(D){return b(`/datasets/${D}/publish/request`,{method:"POST"},!0)}async function pf(D){return b(`/datasets/${D}/publish/status`,{},!0)}async function df(D){return b(`/datasets/${D}/publish/resend`,{method:"POST"},!0)}async function cf(D){let F=D?`?status=${D}`:"";return b(`/admin/publish/requests${F}`,{},!0)}async function nf(D,F){return b(`/admin/publish/${D}/deny`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:F})},!0)}function az0(D){if(!(D instanceof p))return!1;if(D.statusCode===0)return!0;if(D.statusCode===429)return!0;if(D.statusCode>=500&&D.statusCode<600)return!0;if(D.statusCode===403&&/repository has been locked/i.test(D.message))return!0;return!1}async function YQ(D,F=!1,$=!1,J=!1,Q){let X,G=F,H=[],q;for(let K=1;K<=5;K++)try{let V,E=!0;do{if(V=await b(`/admin/publish/${D}/approve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resume:E?G:!0,sandbox:$,s3_lock_continuation_token:X,skip_ci_check:J})},!0),E=!1,V.step_results)H.push(...V.step_results);if(V.hasMore&&V.s3_lock_continuation_token!==void 0)X=V.s3_lock_continuation_token;else break}while(V.hasMore);if(H.length>0)V.step_results=Lf(H);return V}catch(V){if(q=V,K===5||!az0(V)){if(V instanceof p&&H.length>0)V.stepResults=Lf(H);throw V}let Z=V;Q?.({attempt:K,maxAttempts:5,delayMs:1e4,step:Z.step,error:Z.message}),await new Promise((L)=>setTimeout(L,1e4)),G=!0}throw q}function Lf(D){let F=new Map;for(let $ of D)F.set($.step,$);return Array.from(F.values())}async function af(D,F){return b(`/admin/datasets/${D}/enrichment`,{method:"POST",body:JSON.stringify(F)},!0)}async function of(D){return b(`/admin/datasets/${D}/files`,{},!0)}async function sf(D){let F,$=0,J=[],Q=!0;while(Q){let Y=await b(`/admin/datasets/${D}/s3-lock`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({continuation_token:F})},!0);if($+=Y.locked,Y.failed?.length)J.push(...Y.failed);if(Q=Y.hasMore,F=Y.continuation_token,Q&&!F)throw new p(500,"S3 lock paginated response missing continuation_token; aborting to avoid infinite loop")}return{locked:$,failed:J}}async function rf(D){return b(`/admin/datasets/${D}/reset`,{method:"POST"},!0)}async function tf(D,F=!1){return b(`/admin/datasets/${D}`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({force:F})},!0)}async function ef(D){return b("/admin/datasets/bulk-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataset_ids:D})},!0)}async function Dg(D){return b("/admin/datasets/import",{method:"POST",body:JSON.stringify(D)},!0)}async function Fg(D){return b(`/admin/datasets/${D}/sync`,{method:"POST"},!0)}async function $g(){return b("/admin/sync/status",{},!0)}async function Jg(D,F){return b(`/admin/datasets/${D}/reindex`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F??{})},!0)}async function Qg(D,F){return b("/admin/datasets/reindex/bulk",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filter:D,...F??{}})},!0)}async function Yg(){return b("/admin/email-preferences",{},!0)}async function Bg(D){return b("/admin/email-preferences",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(D)},!0)}async function Xg(){return b("/notices",{},"optional")}async function Gg(){return b("/admin/notices",{},!0)}async function Wg(D){return b("/admin/notices",{method:"POST",body:JSON.stringify(D)},!0)}async function Hg(D){return b(`/admin/notices/${D}`,{method:"DELETE"},!0)}async function PW(D){return b("/admin/notify",{method:"POST",body:JSON.stringify(D)},!0)}var CW="https://api.nemar.org",sJ,p,rJ,RW;var i8=P(()=>{x4();NW();oJ();sJ=/^\d{4}-\d{4}-\d{4}-\d{3}[\dX]$/;p=class p extends Error{statusCode;details;step;constructor(D,F,$,J){super(F);this.statusCode=D;this.details=$;this.step=J;this.name="ApiError"}};rJ=class rJ extends p{mode;eta;constructor(D,F,$,J){super(503,F,J);this.mode=D;this.eta=$;this.name="MaintenanceError"}};RW=CW.includes("workers.dev")});function Kg(D){IW=D}function SW(){return IW}function k9(D){if(IW)process.stderr.write(`${D}
|
|
99
99
|
`)}var IW=!1;function XD(D){if(D===0)return"0 B";let F=["B","KB","MB","GB","TB"],$=Math.min(Math.floor(Math.log(D)/Math.log(1024)),F.length-1);return`${(D/1024**$).toFixed($===0?0:1)} ${F[$]}`}function zg(D){return`${XD(D)}/s`}function oz0(D){if(D<60)return`${Math.round(D)}s`;if(D<3600)return`${Math.floor(D/60)}m ${Math.round(D%60)}s`;return`${Math.floor(D/3600)}h ${Math.floor(D%3600/60)}m`}function sz0(D,F=20){let $=Math.round(D/100*F),J=F-$;return`[${"=".repeat($)}${" ".repeat(J)}]`}class BQ{filesCompleted=0;filesTotal;bytesTotal=0;inFlight=new Map;currentFile="";startTime;lastUpdateTime;lastBytesTransferred=0;totalBytesTransferred=0;speedSamples=[];lastRenderedLine="";constructor(D=0,F=0){this.filesTotal=D,this.bytesTotal=F,this.startTime=Date.now(),this.lastUpdateTime=this.startTime}inFlightBytes(){let D=0;for(let F of this.inFlight.values())D+=F.transferred;return D}processLine(D){let F=D.file??D.action?.file;if(D.ok===!0||D.success===!0){this.filesCompleted++;let $=F??this.currentFile,J=$?this.inFlight.get($):void 0,Q=J?J.total||J.transferred:0;if(this.totalBytesTransferred+=Q,$)this.inFlight.delete($);this.render();return}if(D["byte-progress"]!==void 0){let $=F??this.currentFile;if(!$)return;this.currentFile=$;let J=this.inFlight.get($)??{transferred:0,total:0};if(J.transferred=D["byte-progress"]??J.transferred,D["total-size"]!==void 0)J.total=D["total-size"];this.inFlight.set($,J);let Q=Date.now(),Y=(Q-this.lastUpdateTime)/1000;if(Y>0.5){let B=this.totalBytesTransferred+this.inFlightBytes(),G=(B-this.lastBytesTransferred)/Y;if(G>0){if(this.speedSamples.push(G),this.speedSamples.length>5)this.speedSamples.shift()}this.lastBytesTransferred=B,this.lastUpdateTime=Q}this.render()}}incrementFilesCompleted(){this.filesCompleted++}setFilesTotal(D){this.filesTotal=D}setBytesTotal(D){this.bytesTotal=D}getPercent(){let D=this.totalBytesTransferred+this.inFlightBytes();if(this.bytesTotal>0)return Math.min(100,Math.round(D/this.bytesTotal*100));if(this.filesTotal>0)return Math.min(100,Math.round(this.filesCompleted/this.filesTotal*100));return null}getProgress(){return{filesCompleted:this.filesCompleted,filesTotal:this.filesTotal,bytesTransferred:this.totalBytesTransferred+this.inFlightBytes(),bytesTotal:this.bytesTotal,currentFile:this.currentFile||void 0}}render(){let D=this.speedSamples.length>0?this.speedSamples.reduce((B,X)=>B+X,0)/this.speedSamples.length:0,F=this.totalBytesTransferred+this.inFlightBytes(),$=0,J=!1;if(this.bytesTotal>0)$=Math.min(100,Math.round(F/this.bytesTotal*100)),J=!0;else if(this.filesTotal>0)$=Math.min(100,Math.round(this.filesCompleted/this.filesTotal*100)),J=!0;let Q=this.filesTotal>0?`${this.filesCompleted}/${this.filesTotal} files`:`${this.filesCompleted} files`,Y;if(J)Y=`${sz0($)} ${$}% ${Q}`;else Y=Q;if(F>0){let B=this.bytesTotal>0?`${XD(F)}/${XD(this.bytesTotal)}`:XD(F);Y+=` | ${B}`}if(D>0)Y+=` | ${zg(D)}`;if(D>0){let B=0;if(this.bytesTotal>0)B=Math.max(0,this.bytesTotal-F);else for(let X of this.inFlight.values())if(X.total>X.transferred)B+=X.total-X.transferred;if(B>0){let X=B/D;if(X>0)Y+=` | ETA ${oz0(X)}`}}if(Y!==this.lastRenderedLine)process.stderr.write(`\r${W.cyan(Y)}${" ".repeat(10)}`),this.lastRenderedLine=Y}finish(D){let F=(Date.now()-this.startTime)/1000;if(process.stderr.write(`\r${" ".repeat(this.lastRenderedLine.length+15)}\r`),D>0){let $=F>0?`${zg(this.totalBytesTransferred/F)}`:"",J=[`${D} file${D!==1?"s":""} downloaded`,this.totalBytesTransferred>0?XD(this.totalBytesTransferred):"",$].filter(Boolean).join(" | ");process.stderr.write(`${W.green(J)}
|
|
100
100
|
`)}}}var kW=P(()=>{xD()});var Tg={};c4(Tg,{verifyGitHubAuth:()=>y9,toS3Credentials:()=>CD,switchBranch:()=>BE0,setKeyPresent:()=>wg,selectAnnexS3Remote:()=>bW,saveDataset:()=>o8,runCommand:()=>I,resolveUpstreamRef:()=>iW,readRemoteHeadDatasetVersion:()=>nW,readLocalDatasetVersion:()=>cW,pushToGitHub:()=>o1,pushBranch:()=>PF,markInheritedOpenNeuroRemotesIgnored:()=>hW,listDatasetVersions:()=>mW,isWorkingTreeDirty:()=>aW,isGitAnnexDataset:()=>w1,isDataladDataset:()=>qE0,initOrEnableSpecialRemote:()=>Cg,initDataset:()=>n6,gitMergeFastForward:()=>sW,gitFetchOrigin:()=>oW,gitAnnexAdd:()=>i6,getVersionCommit:()=>lW,getRemoteUuid:()=>DH,getLocalDatasetInfo:()=>uW,getKeyHashDirs:()=>WE0,getKeyHashDir:()=>Og,getDatasetStats:()=>JE0,getDatasetIdFromRemote:()=>r8,getDatasetData:()=>WQ,getCurrentBranch:()=>s8,getAnnexWhereisAll:()=>eW,getAnnexS3Remotes:()=>_9,formatBytes:()=>XD,ensureLocalMainBranch:()=>f9,ensureGitAnnexInitialized:()=>fW,enableS3Remote:()=>h4,dropUnusedAnnexObjects:()=>rW,dropFiles:()=>gW,createRevertBranch:()=>pW,createDataladDataset:()=>HE0,countPendingDownload:()=>GQ,copyToAnnexRemote:()=>w8,configureS3Remote:()=>O8,configureLargefiles:()=>g4,configureGitHubRemote:()=>a8,commitRevert:()=>dW,collectFileManifest:()=>tW,cloneDataset:()=>s1,clearAnnexCredentials:()=>kD,checkPrerequisites:()=>v9,checkGitHubSSH:()=>Lg,checkGitAnnexInstalled:()=>_W,checkDownloadPrerequisites:()=>jF,checkAWSCredentials:()=>DE0,batchSetKeysPresent:()=>FH,annexRemoteExists:()=>Ng,acceptGitHubInvitation:()=>x9,NEMAR_S3_REMOTE_NAME:()=>XQ,ANNEX_REMOTE_EXISTS_RE:()=>Mg});import{existsSync as yW,readFileSync as rz0,statSync as tz0}from"fs";import{join as xW}from"path";var{spawn:Ug}=globalThis.Bun;async function I(D,F={}){let $=Ug({cmd:D,cwd:F.cwd,stdout:"pipe",stderr:"pipe",env:{...process.env,GIT_TERMINAL_PROMPT:"0",...F.env}}),J=!1,Q;if(F.timeout)Q=setTimeout(()=>{J=!0,$.kill()},F.timeout);if(SW()){let G=F.cwd?` (cwd=${F.cwd})`:"";k9(W.dim(`$ ${D.join(" ")}${G}`))}let Y=await new Response($.stdout).text(),B=await new Response($.stderr).text(),X=await $.exited;if(Q)clearTimeout(Q);if(SW()){if(Y.trim())k9(W.dim(Y.trimEnd()));if(B.trim())k9(W.yellow(B.trimEnd()));k9(W.dim(`(exit ${X})`))}if(J)return{stdout:Y,stderr:B||`Command timed out after ${Math.round(F.timeout/1000)}s`,exitCode:X??1};return{stdout:Y,stderr:B,exitCode:X}}function Eg(D){return D.split(".").map((F)=>{let $=Number.parseInt(F.replace(/[^0-9]/g,""),10);return Number.isNaN($)?0:$})}function ez0(D,F){let $=Eg(D),J=Eg(F);for(let Q=0;Q<Math.max($.length,J.length);Q++){let Y=$[Q]||0,B=J[Q]||0;if(Y>B)return!0;if(Y<B)return!1}return!0}async function _W(){try{let{stdout:F,exitCode:$,stderr:J}=await I(["git-annex","version"]);if($!==0)return console.warn("git-annex version returned non-zero exit code:",$),console.warn("stderr:",J),{installed:!1,minVersion:"10.0",error:`Version check failed: ${J.trim()}`};let Q=F.match(/version:\s*(\d+\.\d+)/),Y=Q?Q[1]:void 0;if(!Y)console.warn("Could not parse git-annex version from output:",F);return{installed:!0,version:Y,minVersion:"10.0",compatible:Y?ez0(Y,"10.0"):void 0}}catch(F){let $=F instanceof Error?F.message:String(F);if($.includes("ENOENT")||$.includes("not found"))return console.info("git-annex not found in PATH"),{installed:!1,minVersion:"10.0"};return console.error("Error checking git-annex installation:",$),{installed:!1,minVersion:"10.0",error:$}}}async function Lg(){if(process.env.GH_TOKEN)return{accessible:!0,username:"token-auth",useHttps:!0};try{let{stdout:D,stderr:F}=await I(["ssh","-T","-o","BatchMode=yes","-o","StrictHostKeyChecking=accept-new","-o","ConnectTimeout=10","git@github.com"]),$=D+F,J=$.match(/Hi ([^!]+)!/);if(J)return{accessible:!0,username:J[1]};if($.includes("Permission denied"))return{accessible:!1};return{accessible:$.includes("successfully authenticated")}}catch(D){let F=D instanceof Error?D.message:String(D);if(F.includes("ENOENT")||F.includes("not found"))console.info("SSH command not found");else console.error("Error checking GitHub SSH access:",F);return{accessible:!1}}}async function DE0(){if(process.env.AWS_ACCESS_KEY_ID&&process.env.AWS_SECRET_ACCESS_KEY)return{configured:!0,source:"environment"};try{let{stdout:D,exitCode:F}=await I(["aws","configure","get","aws_access_key_id"]);if(F===0&&D.trim())return{configured:!0,source:"aws-cli"}}catch(D){let F=D instanceof Error?D.message:String(D);if(F.includes("ENOENT")||F.includes("not found"))console.info("AWS CLI not found in PATH");else console.error("Error checking AWS credentials:",F)}return{configured:!1}}function Ag(){let D=process.platform;if(D==="darwin")return"brew install git-annex";if(D==="linux")return"apt install git-annex (Debian/Ubuntu)";return"See https://git-annex.branchable.com/install/"}async function v9(){let[D,F]=await Promise.all([_W(),Lg()]),$=[];if(!D.installed)$.push(`git-annex is not installed. Install: ${Ag()}`);else if(D.compatible===!1)$.push(`git-annex version ${D.version} is too old. Required: >= ${D.minVersion}`);if(!F.accessible){if(!(await Rg()).token)$.push("GitHub authentication not configured. Run 'gh auth login' to authenticate.")}return{gitAnnex:D,githubSSH:F,allPassed:$.length===0,errors:$}}async function w1(D){if(!yW(xW(D,".git")))return!1;try{let{exitCode:F}=await I(["git","annex","info"],{cwd:D});return F===0}catch(F){let $=F instanceof Error?F.message:String(F);if(!$.includes("ENOENT")&&!$.includes("not found"))console.error(`Error checking if ${D} is a git-annex dataset:`,$);return!1}}async function n6(D,F={}){if(!F.force&&await w1(D))return{success:!0};try{let $={};if(F.author)$.GIT_AUTHOR_NAME=F.author.name,$.GIT_AUTHOR_EMAIL=F.author.email,$.GIT_COMMITTER_NAME=F.author.name,$.GIT_COMMITTER_EMAIL=F.author.email;let{stderr:J,exitCode:Q}=await I(["git","init","-b","main",D],{...Object.keys($).length>0?{env:$}:{}});if(Q!==0)return{success:!1,error:J.trim()||"Failed to initialize git repository"};let Y=Object.keys($).length>0?{env:$}:{},{stderr:B,exitCode:X}=await I(["git","annex","init"],{cwd:D,...Y});if(X!==0)return{success:!1,error:B.trim()||"Failed to initialize git-annex"};let{stderr:G,exitCode:H}=await I(["git","commit","--allow-empty","-m","Initialize dataset"],{cwd:D,...Y});if(H!==0)return{success:!1,error:G.trim()||"Failed to create initial commit"};let{stderr:q,exitCode:K}=await I(["git","annex","adjust","--unlock"],{cwd:D,...Y});if(K!==0)return{success:!1,error:q.trim()||"Failed to switch to unlocked mode"};return{success:!0}}catch($){return{success:!1,error:$.message}}}async function fW(D){try{let{exitCode:F,stderr:$}=await I(["git","annex","info"],{cwd:D});if(F===0)return{success:!0};if($.includes("First run: git-annex init")){let{stderr:J,exitCode:Q}=await I(["git","annex","init"],{cwd:D});if(Q!==0)return{success:!1,error:J.trim()||"Failed to initialize git-annex"};return{success:!0}}return{success:!1,error:$.trim()||"Failed to check git-annex status"}}catch(F){return{success:!1,error:F.message}}}async function g4(D,F){let $=["*.edf","*.bdf","*.set","*.fif","*.vhdr","*.eeg","*.cnt","*.fdt"],J=["*.tsv","*.json","*.md","*.txt","*.yml","*.yaml","README*","LICENSE*","CHANGES*",".bidsignore",".gitignore"],Q=$.map((G)=>`include=${G}`).join(" or "),Y=J.map((G)=>`exclude=${G}`).join(" and "),B=`(${Q} or largerthan=100kb) and ${Y}`,X=F||B;try{let{stderr:G,exitCode:H}=await I(["git","annex","config","--set","annex.largefiles",X],{cwd:D});if(H!==0)return{success:!1,error:G.trim()||"Failed to configure largefiles"};return{success:!0}}catch(G){return{success:!1,error:G.message}}}async function i6(D,F="."){try{let{stderr:$,exitCode:J}=await I(["git","annex","add",F],{cwd:D});if(J!==0)return{success:!1,error:$.trim()||"Failed to add files to git-annex"};return{success:!0}}catch($){return{success:!1,error:$.message}}}function CD(D){return{accessKeyId:D.access_key_id,secretAccessKey:D.secret_access_key,sessionToken:D.session_token}}function vW(D){let F=[/^\(merging .* into .*\.\.\.\)$/,/^\(recording state in git\.\.\.\)$/,/^\(scanning for /,/^\(checking /];return D.split(`
|
|
101
101
|
`).filter(($)=>{let J=$.trim();if(!J)return!1;if(J.includes("setting annex-ignore"))return!1;if(F.some((Q)=>Q.test(J)))return!1;return!0}).join(`
|
|
@@ -201,11 +201,11 @@ Making repository public: ${D}
|
|
|
201
201
|
Making repository private: ${D}
|
|
202
202
|
`)),console.log("This will restrict access to collaborators only."),console.log();let $=await k0(`Make ${D} private?`,F);if($!=="confirmed"){console.log(W.dim($==="declined"?"Skipped":"Cancelled"));return}let J=C(`Setting ${D} to private...`).start();try{await OW(D,"private"),J.succeed(`Repository ${D} is now private`)}catch(Q){QD(Q,J,"Failed to change visibility",{404:"Dataset not found"})}});r0.addCommand(XH);var HQ=new i0("ci").description("CI workflow management");HQ.command("check").description("Check CI workflow status for a dataset").argument("<dataset-id>","Dataset ID (e.g., nm000104)").action(async(D)=>{if(!f0())return;let F=C(`Checking CI status for ${D}...`).start();try{let $=await kf(D);F.stop(),console.log(`
|
|
203
203
|
${W.cyan("CI Status:")} ${D}
|
|
204
|
-
`);let J=$.bids_validation.present,Q=J?W.green("[x]"):W.red("[ ]");if(console.log(` ${Q} BIDS Validation`),J){let X=$.bids_validation.status==="success"?W.green:$.bids_validation.status==="failure"?W.red:W.yellow;if(console.log(` Status: ${X($.bids_validation.status)}`),$.bids_validation.url)console.log(` URL: ${W.dim($.bids_validation.url)}`)}else console.log(` ${W.dim("Not deployed. Use 'nemar admin ci add' to deploy.")}`);let Y=$.version_check.present,B=Y?W.green("[x]"):W.red("[ ]");if(console.log(` ${B} Version Check`),!Y)console.log(` ${W.dim("Not deployed. Use 'nemar admin ci add' to deploy.")}`);console.log()}catch($){QD($,F,"Failed to check CI status",{404:"Dataset not found"})}});HQ.command("add").description("Deploy CI workflows to a dataset repository (or all with --all)").argument("[dataset-id]","Dataset ID (e.g., nm000104)").option("--all","Deploy to all dataset repositories").option(T0,j0).option(b0,y0).action(async(D,F)=>{if(!f0())return;if(F.all){let
|
|
205
|
-
Deploy CI workflows to ${
|
|
206
|
-
`)),console.log("This will add/update the following workflows on each:"),console.log(" 1. BIDS Validation (runs on PRs)"),console.log(" 2. Version Check (ensures version bump on PRs)"),console.log(" 3. PR Merge Handler (creates releases, publishes DOIs)")
|
|
204
|
+
`);let J=$.bids_validation.present,Q=J?W.green("[x]"):W.red("[ ]");if(console.log(` ${Q} BIDS Validation`),J){let X=$.bids_validation.status==="success"?W.green:$.bids_validation.status==="failure"?W.red:W.yellow;if(console.log(` Status: ${X($.bids_validation.status)}`),$.bids_validation.url)console.log(` URL: ${W.dim($.bids_validation.url)}`)}else console.log(` ${W.dim("Not deployed. Use 'nemar admin ci add' to deploy.")}`);let Y=$.version_check.present,B=Y?W.green("[x]"):W.red("[ ]");if(console.log(` ${B} Version Check`),!Y)console.log(` ${W.dim("Not deployed. Use 'nemar admin ci add' to deploy.")}`);console.log()}catch($){QD($,F,"Failed to check CI status",{404:"Dataset not found"})}});HQ.command("add").description("Deploy CI workflows to a dataset repository (or all with --all)").argument("[dataset-id]","Dataset ID (e.g., nm000104)").option("--all","Deploy to all dataset repositories").option("--no-validate","Skip post-deploy parseability check (saves ~2.5 s per dataset; use for fleet deploys with --all)").option(T0,j0).option(b0,y0).action(async(D,F)=>{if(!f0())return;let $=F.validate===!1;if(F.all){let Y=C("Fetching dataset list...").start(),B;try{if(B=(await I9({limit:1000})).datasets,Y.succeed(`Found ${B.length} datasets`),B.length>=1000)console.log(W.yellow("Warning: reached 1000 dataset limit; some datasets may be skipped"))}catch(q){QD(q,Y,"Failed to fetch datasets");return}if(console.log(W.cyan(`
|
|
205
|
+
Deploy CI workflows to ${B.length} datasets
|
|
206
|
+
`)),console.log("This will add/update the following workflows on each:"),console.log(" 1. BIDS Validation (runs on PRs)"),console.log(" 2. Version Check (ensures version bump on PRs)"),console.log(" 3. PR Merge Handler (creates releases, publishes DOIs)"),$)console.log(W.dim(" (post-deploy parseability check disabled via --no-validate)"));console.log();let X=await k0(`Deploy CI workflows to all ${B.length} datasets?`,F);if(X!=="confirmed"){console.log(W.dim(X==="declined"?"Skipped":"Cancelled"));return}let G=0,H=0;for(let q of B){let K=C(`Deploying to ${q.dataset_id}...`).start();try{let V=await f4(q.dataset_id,{validate:!$});if(V.validation_warnings&&V.validation_warnings.length>0){K.warn(`${q.dataset_id}: deployed (with warnings)`);for(let E of V.validation_warnings)console.log(` ${W.yellow("!")} ${E}`)}else K.succeed(`${q.dataset_id}: deployed`);G++}catch(V){let E=V instanceof p?V.message:String(V);K.fail(`${q.dataset_id}: ${E}`),H++}}console.log(),console.log(W.cyan(`Done: ${G} succeeded, ${H} failed out of ${B.length}`));return}if(!D){console.error(W.red("Error: dataset-id is required (or use --all)"));return}if(console.log(W.cyan(`
|
|
207
207
|
Deploy CI workflows to: ${D}
|
|
208
|
-
`)),console.log("This will add the following workflows:"),console.log(" 1. BIDS Validation (runs on PRs)"),console.log(" 2. Version Check (ensures version bump on PRs)"),console.log(" 3. PR Merge Handler (creates releases, publishes DOIs)")
|
|
208
|
+
`)),console.log("This will add the following workflows:"),console.log(" 1. BIDS Validation (runs on PRs)"),console.log(" 2. Version Check (ensures version bump on PRs)"),console.log(" 3. PR Merge Handler (creates releases, publishes DOIs)"),$)console.log(W.dim(" (post-deploy parseability check disabled via --no-validate)"));console.log();let J=await k0(`Deploy CI workflows to ${D}?`,F);if(J!=="confirmed"){console.log(W.dim(J==="declined"?"Skipped":"Cancelled"));return}let Q=C(`Deploying CI workflows to ${D}...`).start();try{let Y=await f4(D,{validate:!$});Q.succeed("CI workflows deployed"),console.log();for(let B of Y.workflows_deployed)console.log(` ${W.green("[x]")} ${B}`);if(Y.validation_warnings&&Y.validation_warnings.length>0){console.log(),console.log(W.yellow("Validation warnings (best-effort; deploy succeeded):"));for(let B of Y.validation_warnings)console.log(` ${W.yellow("!")} ${B}`)}console.log()}catch(Y){QD(Y,Q,"Failed to deploy CI workflows",{404:"Dataset not found"})}});HQ.command("sync").description("Sync deployed CI workflows to current templates (only writes drifted/missing files)").argument("[dataset-id]","Dataset ID (e.g., nm000104)").option("--all","Sync across all dataset repositories").option(T0,j0).option(b0,y0).action(async(D,F)=>{if(!f0())return;if(F.all){let J=C("Fetching dataset list...").start(),Q;try{if(Q=(await I9({limit:1000})).datasets,J.succeed(`Found ${Q.length} datasets`),Q.length>=1000)console.log(W.yellow("Warning: reached 1000 dataset limit; some datasets may be skipped"))}catch(H){QD(H,J,"Failed to fetch datasets");return}console.log(W.cyan(`
|
|
209
209
|
Sync CI templates across ${Q.length} datasets (writes only diffs)
|
|
210
210
|
`));let Y=await k0(`Sync templates on all ${Q.length} datasets?`,F);if(Y!=="confirmed"){console.log(W.dim(Y==="declined"?"Skipped":"Cancelled"));return}let B=0,X=0,G=0;for(let H of Q){let q=C(`Syncing ${H.dataset_id}...`).start();try{let K=await wW(H.dataset_id),V=K.changed.length+K.added.length;if(K.errors.length>0)q.warn(`${H.dataset_id}: ${V} updated, ${K.errors.length} error(s)`),G++;else if(V===0)q.succeed(`${H.dataset_id}: up to date`),B++;else{let E=[];if(K.added.length>0)E.push(`+${K.added.length} added`);if(K.changed.length>0)E.push(`~${K.changed.length} updated`);q.succeed(`${H.dataset_id}: ${E.join(", ")}`),X++}}catch(K){let V=K instanceof p?K.message:String(K);q.fail(`${H.dataset_id}: ${V}`),G++}}console.log(),console.log(W.cyan(`Done: ${B} up-to-date, ${X} updated, ${G} with errors`));return}if(!D){console.error(W.red("Error: dataset-id is required (or use --all)"));return}let $=C(`Syncing CI templates for ${D}...`).start();try{let J=await wW(D),Q=J.changed.length+J.added.length;if(J.errors.length>0)$.warn(`${D}: ${J.errors.length} error(s)`);else if(Q===0)$.succeed(`${D}: already up to date`);else $.succeed(`${D}: synced`);if(console.log(),console.log(` ${W.dim("Checked:")} ${J.checked.join(", ")}`),J.added.length>0)console.log(` ${W.green("Added:")} ${J.added.join(", ")}`);if(J.changed.length>0)console.log(` ${W.yellow("Updated:")} ${J.changed.join(", ")}`);if(!J.committed&&Q>0&&J.errors.length===0)console.log(` ${W.yellow("Note:")} listed changes were not committed`);if(J.list_failed)console.log(` ${W.red("Warning:")} workflow directory listing failed; presence is unknown`);if(J.errors.length>0){console.log(` ${W.red("Errors:")}`);for(let Y of J.errors)console.log(` - ${Y}`)}console.log()}catch(J){QD(J,$,"Failed to sync CI templates",{404:"Dataset not found"})}});r0.addCommand(HQ);var h9=new i0("doi").description("DOI management");h9.command("create").description("Create concept DOI for a dataset").argument("<dataset-id>","Dataset ID (e.g., nm000104)").option("--title <title>","DOI title (defaults to dataset name)").option("--description <desc>","DOI description").option("--provider <provider>","DOI provider: ezid (default) or zenodo","ezid").option("--sandbox","Use sandbox/test DOI").option(T0,j0).option(b0,y0).action(async(D,F)=>{if(!f0())return;let $=C("Fetching dataset info...").start(),J;try{J=await uD(D),$.succeed(`Found dataset: ${J.name}`)}catch(G){if(G instanceof p){if($.fail(G.message),G.statusCode===404)console.log(W.dim(" Dataset not found"))}else $.fail("Failed to fetch dataset");return}try{let G=await S9(D);if(G.concept_doi){if(console.log(W.yellow(`
|
|
211
211
|
Dataset already has a concept DOI:`)),console.log(` Concept DOI: ${W.cyan(G.concept_doi)}`),G.zenodo_concept_url)console.log(` Zenodo URL: ${G.zenodo_concept_url}`);return}}catch(G){if(process.env.DEBUG)console.error("[debug] DOI info fetch:",G)}if(console.log(),console.log(W.cyan("Dataset Information:")),console.log(` ID: ${J.dataset_id}`),console.log(` Name: ${J.name}`),J.github_repo)console.log(` GitHub: ${J.github_repo}`);if(F.sandbox)console.log(` Mode: ${W.yellow("SANDBOX (test DOI)")}`);console.log();let Q=F.provider==="zenodo"?"zenodo":"ezid";if(F.sandbox){if(console.log(W.yellow("\u2501".repeat(60))),console.log(W.yellow.bold(" SANDBOX MODE ENABLED")),console.log(W.yellow("\u2501".repeat(60))),Q==="zenodo")console.log(W.yellow(" \u2022 Using Zenodo sandbox (sandbox.zenodo.org)"));else console.log(W.yellow(" \u2022 Using EZID test shoulder (doi:10.5072/FK2)")),console.log(W.yellow(" \u2022 Test DOIs auto-delete after 2 weeks"));console.log(W.yellow(" \u2022 DOI will NOT be indexed by DataCite")),console.log(W.yellow(" \u2022 DOI will NOT resolve in production")),console.log(W.yellow(" \u2022 Use this for testing workflows only")),console.log(W.yellow("\u2501".repeat(60))),console.log()}console.log(W.red("WARNING: DOIs are PERMANENT and cannot be deleted!")),console.log(W.dim("The DOI will be pre-reserved but not published until the first version release.")),console.log(` Provider: ${W.cyan(Q.toUpperCase())}`),console.log();let Y=F.sandbox?`Create TEST concept DOI via ${Q.toUpperCase()} SANDBOX?`:`Create PERMANENT concept DOI via ${Q.toUpperCase()} PRODUCTION?`,B=await k0(Y,F);if(B!=="confirmed"){console.log(W.dim(B==="declined"?"Skipped":"Cancelled"));return}let X=C(`Creating concept DOI via ${Q.toUpperCase()}...`).start();try{let G=await gf(D,{title:F.title,description:F.description,sandbox:F.sandbox,provider:Q});X.succeed("Concept DOI created successfully");let H=C("Applying branch protection...").start();try{let q=await $Q(D);if(q.warnings&&q.warnings.length>0){H.warn("Branch protection applied with warnings");for(let K of q.warnings)console.log(W.yellow(` Warning: ${K}`))}else H.succeed("Branch protection applied")}catch(q){if(H.warn("Could not apply branch protection"),q instanceof p){if(console.log(W.dim(` ${q.message}`)),q.statusCode===403)console.log(W.dim(" Check admin credentials and permissions"))}else console.log(W.dim(` ${q instanceof Error?q.message:"Unknown error"}`));console.log(W.dim(" Manual setup: Go to GitHub repo Settings > Branches > Add rule"))}if(console.log(),console.log(W.green("DOI Information:")),console.log(` Concept DOI: ${W.cyan(G.concept_doi)}`),console.log(` Provider: ${G.provider.toUpperCase()}`),G.provider==="ezid")console.log(` DOI URL: ${G.doi_url}`),console.log(` EZID ID: ${G.ezid_identifier}`);else console.log(` Zenodo URL: ${G.zenodo_url}`);if(G.metadata_warning)console.log(W.yellow(` Warning: ${G.metadata_warning}`));if(console.log(),console.log(W.yellow("Next steps:")),console.log(" 1. Update dataset_description.json with DatasetDOI field"),console.log(" 2. Create a PR and merge it to trigger version DOI publication"),console.log(),F.sandbox)console.log(W.dim("Note: This is a sandbox DOI and will not resolve in production."))}catch(G){if(G instanceof p){if(X.fail(G.message),G.statusCode===403)console.log(W.dim(" This command requires admin privileges"))}else X.fail("Failed to create concept DOI"),console.log(W.dim(` ${w0(G)}`))}});h9.command("info").description("Get DOI info for a dataset").argument("<dataset-id>","Dataset ID (e.g., nm000104)").action(async(D)=>{if(!f0())return;let F=C("Fetching DOI info...").start();try{let $=await S9(D);if(F.stop(),console.log(),console.log(W.cyan(`DOI Information for ${D}:`)),console.log(` Dataset Name: ${$.name}`),console.log(),$.concept_doi){if(console.log(W.green("Concept DOI:")),console.log(` DOI: ${$.concept_doi}`),console.log(` URL: https://doi.org/${$.concept_doi}`),console.log(` Provider: ${($.doi_provider||"zenodo").toUpperCase()}`),$.doi_provider==="ezid"){if($.ezid_identifier)console.log(` EZID ID: ${$.ezid_identifier}`);if($.ezid_status){let J=$.ezid_status==="public"?W.green:W.yellow;console.log(` Status: ${J($.ezid_status)}`)}}if($.zenodo_concept_url){if(console.log(` Zenodo: ${$.zenodo_concept_url}`),$.zenodo_concept_url.includes("sandbox.zenodo.org"))console.log(),console.log(W.yellow("Mode: SANDBOX (test DOI)")),console.log(W.yellow(" This DOI is not indexed by DataCite and will not resolve in production"))}}else console.log(W.yellow("No concept DOI created yet")),console.log(W.dim(" Use 'nemar admin doi create' to create one"));if(console.log(),$.latest_version_doi){if(console.log(W.green("Latest Version DOI:")),console.log(` DOI: ${$.latest_version_doi}`),console.log(` URL: https://doi.org/${$.latest_version_doi}`),$.zenodo_latest_version_url)console.log(` Zenodo: ${$.zenodo_latest_version_url}`)}else if($.concept_doi)console.log(W.yellow("No version DOI published yet")),console.log(W.dim(" Version DOIs are created automatically on PR merge"))}catch($){if($ instanceof p){if(F.fail($.message),$.statusCode===404)console.log(W.dim(" Dataset not found"));else if($.statusCode===403)console.log(W.dim(" This command requires admin privileges"))}else F.fail("Failed to fetch DOI info")}});h9.command("update").description("Update EZID DOI metadata or status").argument("<dataset-id>","Dataset ID (e.g., nm000104)").option("--make-public","Transition DOI from reserved to public (permanent)").option("--refresh","Refresh metadata from dataset_description.json and .nemar/metadata.json").option(T0,j0).option(b0,y0).action(async(D,F)=>{if(!f0())return;if(!F.makePublic&&!F.refresh){console.log(W.yellow("No action specified. Use --make-public and/or --refresh."));return}if(F.makePublic){console.log(W.red("WARNING: Making a DOI public is PERMANENT!")),console.log(W.dim(" The DOI will be findable in DataCite and cannot be reverted.")),console.log();let J=await k0(`Make DOI for ${D} PUBLIC and permanent?`,F);if(J!=="confirmed"){console.log(W.dim(J==="declined"?"Skipped":"Cancelled"));return}}let $=C("Updating DOI...").start();try{let J=await TW(D,{status:F.makePublic?"public":void 0,refresh_metadata:F.refresh});$.succeed("DOI updated successfully"),console.log(),console.log(` EZID ID: ${W.cyan(J.ezid_identifier)}`),console.log(` Status: ${J.status==="public"?W.green(J.status):W.yellow(J.status)}`),console.log(` URL: ${J.doi_url}`)}catch(J){if(J instanceof p){if($.fail(J.message),J.statusCode===400)console.log(W.dim(" DOI update is only supported for EZID-managed DOIs"))}else $.fail("Failed to update DOI"),console.log(W.dim(` ${w0(J)}`))}});h9.command("enrich").description("Enrich DOI metadata with ORCIDs, descriptions, funding, and more").argument("<dataset-id>","Dataset ID (e.g., nm000104)").option("--no-llm","Skip LLM-based enrichment from README").option("--sandbox","Use sandbox DOI").option(T0,j0).option(b0,y0).action(async(D,F)=>{if(!f0())return;let $=C("Fetching dataset and existing enrichment...").start(),J;try{J=await uD(D),$.succeed(`Dataset: ${J.name}`)}catch(E){if(E instanceof p)$.fail(E.message);else $.fail("Failed to fetch dataset");return}let Q,Y=!1;try{Q=await S9(D)}catch(E){if(E instanceof p&&E.statusCode===404);else Y=!0,console.log(W.yellow(` Warning: Could not fetch DOI info: ${w0(E)}`))}if(Q?.concept_doi)console.log(` DOI: ${W.cyan(Q.concept_doi)}`);let B={version:"2.0"};if(J.github_repo){let E=C("Reading existing metadata...").start(),Z=await bg(J.github_repo,".nemar/metadata.json");if(Z)try{let L=JSON.parse(Z);if(L&&typeof L==="object"&&L.version==="2.0")B=L,E.succeed(`Loaded existing metadata (stage: ${L.pipeline_stage||"unknown"})`);else E.warn("Existing metadata has unsupported version, starting fresh")}catch(L){E.warn(`Could not parse existing metadata (${L instanceof Error?L.message:String(L)}), starting fresh`)}else E.info("No existing .nemar/metadata.json found, starting fresh")}if(F.llm!==!1&&J.github_repo){console.log(),console.log(W.cyan("--- Running LLM enrichment pipeline (CI workflow) ---"));let E=C("Triggering llm-enrichment workflow...").start();try{let{spawn:Z}=awaitPromise.resolve(globalThis.Bun),L=J.github_repo,A=Z({cmd:["gh","workflow","run","llm-enrichment.yml","--repo",L,"--ref","main"],stdout:"pipe",stderr:"pipe"}),M=await new Response(A.stderr).text();if(await A.exited!==0)throw Error(`Failed to trigger workflow: ${M.trim()}`);E.text="Waiting for workflow to register...",await new Promise((y)=>setTimeout(y,3000)),E.text="Polling workflow status...";let w=60,k="",O=0;for(let y=0;y<w;y++){let d=Z({cmd:["gh","run","list","--repo",L,"--workflow","llm-enrichment.yml","-L","1","--json","databaseId,status,conclusion"],stdout:"pipe",stderr:"pipe"}),W0=await new Response(d.stdout).text(),F0=await new Response(d.stderr).text();if(await d.exited!==0){if(O++,O>=3){E.warn(`gh CLI error: ${F0.trim()}`);break}await new Promise((e)=>setTimeout(e,5000));continue}try{let e=JSON.parse(W0.trim());if(O=0,e.length>0){let N0=e[0];if(N0.status==="completed"){k=N0.conclusion||"unknown";break}E.text=`Workflow ${N0.status}... (${y*5}s)`}}catch(e){if(O++,O>=3){E.warn(`Unable to parse workflow status: ${e instanceof Error?e.message:String(e)} (raw: ${W0.trim().slice(0,200)})`);break}}await new Promise((e)=>setTimeout(e,5000))}let j=!1;if(!k)E.warn("Workflow timed out after 5 minutes (may still be running)");else if(k==="success"){E.succeed("LLM enrichment workflow completed successfully");let y=await bg(L,".nemar/metadata.json");if(y)try{let d=JSON.parse(y);if(d&&typeof d==="object"&&d.version==="2.0"){Object.assign(B,d),j=!0;let W0=d.pipeline_stage||"unknown";if(console.log(W.dim(` Pipeline stage: ${W0}`)),B.authors){let F0=Object.keys(B.authors).length;console.log(W.dim(` Authors: ${F0}`))}}}catch(d){console.log(W.yellow(` Warning: Could not parse updated metadata: ${d instanceof Error?d.message:String(d)}`)),console.log(W.dim(" Using pre-workflow enrichment data"))}else console.log(W.yellow(" Warning: Could not fetch updated metadata after successful workflow.")),console.log(W.dim(" Author data below may be from a previous run."))}else E.fail(`LLM enrichment workflow failed (conclusion: ${k})`);if(!j)console.log(W.yellow(" ORCID discovery did not complete. Authors below may be from previous metadata."))}catch(Z){E.fail("LLM enrichment pipeline failed"),console.log(W.dim(` ${w0(Z)}`)),console.log(W.yellow(" ORCID discovery did not run. You will need to enter ORCIDs manually."))}}console.log(),console.log(W.cyan("--- Author ORCIDs ---"));let X=B.authors||{},G=Object.keys(X);if(G.length>0){let E=G.filter((L)=>X[L]?.orcid),Z=G.filter((L)=>!X[L]?.orcid);console.log(W.dim(` Discovered ${G.length} authors from pipeline:`));for(let L of E)console.log(W.green(` [x] ${L}: ${X[L]?.orcid}`));for(let L of Z)console.log(W.yellow(` [ ] ${L}: no ORCID found`));if(Z.length>0)console.log(W.dim(` ${Z.length} author(s) missing ORCIDs.`))}let{updateAuthors:H}=await D0.prompt([{type:"confirm",name:"updateAuthors",message:G.length>0?"Add or correct author ORCIDs?":"Add author ORCIDs manually?",default:!1}]);if(H){let E={},Z=!0;while(Z){let{authorName:L}=await D0.prompt([{type:"input",name:"authorName",message:'Author name (as in BIDS, e.g., "Shirazi, Yahya"):'}]);if(!L)break;let A=X[L];if(A?.orcid)console.log(W.dim(` Current ORCID: ${A.orcid}`));let{orcid:M}=await D0.prompt([{type:"input",name:"orcid",message:`ORCID for "${L}" (Enter to ${A?.orcid?"keep current":"skip"}):`,validate:(O)=>{if(!O)return!0;return sJ.test(O)||"Invalid ORCID format (XXXX-XXXX-XXXX-XXXX)"}}]),R={};if(M)R.orcid=M;let{affiliation:w}=await D0.prompt([{type:"input",name:"affiliation",message:`Affiliation for "${L}" (optional):`}]);if(w)R.affiliations=[{name:w}];if(R.orcid||R.affiliations)E[L]=R;let{more:k}=await D0.prompt([{type:"confirm",name:"more",message:"Add another author?",default:!0}]);Z=k}if(Object.keys(E).length>0){let L={...B.authors||{}};for(let[A,M]of Object.entries(E)){let R=L[A]||{};L[A]={...R,...M,orcid:M.orcid||R.orcid}}B.authors=L}}console.log(),console.log(W.cyan("--- Dataset stats ---"));let q=C("Computing dataset sizes and formats...").start();try{let E=await of(D),Z=XD(E.total_size);B.sizes=[`${Z} (${E.file_count} files)`],B.formats=E.extensions,q.succeed(`Sizes: ${Z} (${E.file_count} files), Formats: ${E.extensions.join(", ")}`)}catch(E){q.warn("Could not compute dataset stats"),console.log(W.dim(` ${w0(E)}`))}console.log(),console.log(W.cyan("--- Review ---")),console.log(JSON.stringify(B,null,2)),console.log();let K=await k0("Commit to repo and refresh DOI?",F,!0);if(K!=="confirmed"){console.log(W.dim(K==="declined"?"Skipped":"Cancelled"));return}let V=C("Saving enrichment...").start();try{let E=await af(D,B);if(V.succeed(E.message),E.bidsignore_updated)console.log(W.dim(" .bidsignore updated to include .nemar/"));if(!Q&&Y)try{Q=await S9(D)}catch(Z){if(process.env.DEBUG)console.error("[debug] DOI info re-fetch:",Z)}if(Q?.ezid_identifier){let Z=C("Refreshing DOI metadata...").start();try{await TW(D,{refresh_metadata:!0}),Z.succeed("DOI metadata refreshed")}catch(L){Z.warn("Could not refresh DOI metadata"),console.log(W.dim(` ${w0(L)}`))}}else if(Y)console.log(W.yellow(" DOI refresh skipped: could not verify DOI exists. Run 'nemar admin doi update --refresh' manually."))}catch(E){if(E instanceof p)V.fail(E.message);else V.fail("Failed to save enrichment"),console.log(W.dim(` ${w0(E)}`))}});r0.addCommand(h9);var qQ=new i0("publish").description("Publication workflow management");qQ.command("list").description("List publication requests").option("-s, --status <status>","Filter by status (requested, approving, published, denied)").addHelpText("after",`
|
|
@@ -744,7 +744,7 @@ Status Flow:
|
|
|
744
744
|
Examples:
|
|
745
745
|
$ nemar dataset publish request nm000104
|
|
746
746
|
$ nemar dataset publish status nm000104 # Check request status`).action(async(D)=>{if(!L0())console.log(W.red("Error: Not authenticated")),console.log("Run 'nemar auth login' first"),process.exit(1);let F=C(`Requesting publication for ${D}...`).start();try{let $=await QQ(D);F.succeed($.message),console.log(W.dim(`
|
|
747
|
-
Admins have been notified. Use 'nemar dataset publish status' to check progress.`))}catch($){if($ instanceof p){if(F.fail($.message),console.log(W.dim(` ${$.message}`)),$.statusCode===409)console.log(W.dim(" Use 'nemar dataset publish resend' to remind admins."));else if($.statusCode===403)console.log(W.dim(" Only the dataset owner can request publication."))}else{F.fail("Failed to request publication");let J=$ instanceof Error?$.message:String($);console.log(W.dim(` Error details: ${J}`))}
|
|
747
|
+
Admins have been notified. Use 'nemar dataset publish status' to check progress.`))}catch($){if($ instanceof p){if(F.fail($.message),console.log(W.dim(` ${$.message}`)),$.statusCode===409)console.log(W.dim(" Use 'nemar dataset publish resend' to remind admins."));else if($.statusCode===403)console.log(W.dim(" Only the dataset owner can request publication."))}else{F.fail("Failed to request publication");let J=$ instanceof Error?$.message:String($);console.log(W.dim(` Error details: ${J}`))}}});CQ.command("status").description("Check publication status of a dataset").argument("<dataset-id>","Dataset ID (e.g., nm000104)").addHelpText("after",`
|
|
748
748
|
Description:
|
|
749
749
|
Check the status of your publication request and see progress through
|
|
750
750
|
the approval workflow.
|
|
@@ -776,7 +776,7 @@ Examples:
|
|
|
776
776
|
${W.cyan("Publication Status:")} ${D}
|
|
777
777
|
`);let Q={published:W.green,denied:W.red,approving:W.yellow}[$.status]||W.dim;if(console.log(` Status: ${Q($.status)}`),$.requested_at)console.log(` Requested: ${W.dim($.requested_at)}`);if($.requested_by)console.log(` Requested by: ${W.dim($.requested_by)}`);if($.status==="denied"&&$.denied_reason)console.log(`
|
|
778
778
|
${W.red("Reason:")} ${$.denied_reason}`);if($.status==="approving"){let Y=["ci_check","repo_public","s3_public_read","tag_protect","doi_create","update_metadata","update_readme","create_tag","create_release","upload_to_zenodo","publish_doi","s3_lock","generate_archive","notify_user"],B=$.steps_completed||[];console.log(`
|
|
779
|
-
Steps:`);for(let X of Y){let G=B.includes(X),H=$.current_step===X,q=G?W.green("[x]"):H?W.yellow("[>]"):W.dim("[ ]"),K=X.replace(/_/g," ");console.log(` ${q} ${K}${H&&$.last_error?W.red(` (error: ${$.last_error})`):""}`)}}if($.status==="published"&&$.approved_at)console.log(` Published: ${W.dim($.approved_at)}`);console.log()}catch($){if($ instanceof p)F.fail($.message),console.log(W.dim(` ${$.message}`));else{F.fail("Failed to check publication status");let J=$ instanceof Error?$.message:String($);console.log(W.dim(` Error details: ${J}`))}
|
|
779
|
+
Steps:`);for(let X of Y){let G=B.includes(X),H=$.current_step===X,q=G?W.green("[x]"):H?W.yellow("[>]"):W.dim("[ ]"),K=X.replace(/_/g," ");console.log(` ${q} ${K}${H&&$.last_error?W.red(` (error: ${$.last_error})`):""}`)}}if($.status==="published"&&$.approved_at)console.log(` Published: ${W.dim($.approved_at)}`);console.log()}catch($){if($ instanceof p)F.fail($.message),console.log(W.dim(` ${$.message}`));else{F.fail("Failed to check publication status");let J=$ instanceof Error?$.message:String($);console.log(W.dim(` Error details: ${J}`))}}});CQ.command("resend").description("Resend publication request notification to admins").argument("<dataset-id>","Dataset ID (e.g., nm000104)").addHelpText("after",`
|
|
780
780
|
Description:
|
|
781
781
|
Resend the publication request notification email to all NEMAR admins.
|
|
782
782
|
Use this if admins haven't responded to your original request.
|
|
@@ -790,7 +790,7 @@ When to Use:
|
|
|
790
790
|
- Your request status is still "requested"
|
|
791
791
|
|
|
792
792
|
Examples:
|
|
793
|
-
$ nemar dataset publish resend nm000104`).action(async(D)=>{if(!L0())console.log(W.red("Error: Not authenticated")),console.log("Run 'nemar auth login' first"),process.exit(1);let F=C(`Resending notification for ${D}...`).start();try{let $=await df(D);F.succeed($.message)}catch($){if($ instanceof p){if(F.fail($.message),console.log(W.dim(` ${$.message}`)),$.statusCode===404)console.log(W.dim(" Publication request not found for this dataset."))}else{F.fail("Failed to resend notification");let J=$ instanceof Error?$.message:String($);console.log(W.dim(` Error details: ${J}`))}
|
|
793
|
+
$ nemar dataset publish resend nm000104`).action(async(D)=>{if(!L0())console.log(W.red("Error: Not authenticated")),console.log("Run 'nemar auth login' first"),process.exit(1);let F=C(`Resending notification for ${D}...`).start();try{let $=await df(D);F.succeed($.message)}catch($){if($ instanceof p){if(F.fail($.message),console.log(W.dim(` ${$.message}`)),$.statusCode===404)console.log(W.dim(" Publication request not found for this dataset."))}else{F.fail("Failed to resend notification");let J=$ instanceof Error?$.message:String($);console.log(W.dim(` Error details: ${J}`))}}});FD.addCommand(CQ);FD.command("clone").description("Clone a dataset from NEMAR").argument("<dataset-id>","Dataset ID (e.g., nm000104)").option("-o, --output <path>","Output directory (default: ./<dataset-id>)").addHelpText("after",`
|
|
794
794
|
Description:
|
|
795
795
|
Clone a NEMAR dataset repository with git-annex initialized.
|
|
796
796
|
Data files are not downloaded; use 'nemar dataset get' afterward.
|
package/package.json
CHANGED