flintmaker 0.2.0 → 0.2.2
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/README.md
CHANGED
|
@@ -58,7 +58,7 @@ flint "add a dark mode toggle" # one task, then exit (plain output, fine for
|
|
|
58
58
|
|
|
59
59
|
**Updates**
|
|
60
60
|
|
|
61
|
-
flint checks for a new version
|
|
61
|
+
flint checks for a new version in the background (on every start, at most every 5 minutes) and installs it when it was installed with `npm i -g` or the FlintMaker installer (never with sudo); restart to use it. `flint update` updates right away. Turn it off with `FLINT_NO_UPDATE=1` (it is also off when `CI` is set).
|
|
62
62
|
|
|
63
63
|
Uses credits from your FlintMaker plan — see [pricing](https://flintmaker.com/pricing). Respects `NO_COLOR`.
|
|
64
64
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as u,d}from"./chunk-K3ZZ2VJH.js";import{spawn as z,spawnSync as Y}from"node:child_process";import{accessSync as O,chmodSync as K,closeSync as q,constants as F,existsSync as I,mkdirSync as T,openSync as G,readFileSync as U,realpathSync as Z,rmSync as B,writeFileSync as w}from"node:fs";import{homedir as D}from"node:os";var f="flintmaker",Q=`https://registry.npmjs.org/${f}/latest`,X=
|
|
1
|
+
import{c as u,d}from"./chunk-K3ZZ2VJH.js";import{spawn as z,spawnSync as Y}from"node:child_process";import{accessSync as O,chmodSync as K,closeSync as q,constants as F,existsSync as I,mkdirSync as T,openSync as G,readFileSync as U,realpathSync as Z,rmSync as B,writeFileSync as w}from"node:fs";import{homedir as D}from"node:os";var f="flintmaker",Q=`https://registry.npmjs.org/${f}/latest`,X=300*1e3,_=/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/,x=n=>typeof n=="string"&&_.test(n);function nn(n,e){let r=_.exec(n),t=_.exec(e);if(!r||!t)return 0;for(let a=1;a<=3;a++){let l=Number(r[a])-Number(t[a]);if(l)return l>0?1:-1}let o=r[4],s=t[4];if(o===s)return 0;if(o===void 0)return 1;if(s===void 0)return-1;let i=o.split("."),c=s.split(".");for(let a=0;a<Math.max(i.length,c.length);a++){if(i[a]===void 0)return-1;if(c[a]===void 0)return 1;if(i[a]===c[a])continue;let l=/^\d+$/.test(i[a]),m=/^\d+$/.test(c[a]);return l&&m?Number(i[a])>Number(c[a])?1:-1:l!==m?l?-1:1:i[a]>c[a]?1:-1}return 0}var v=(n,e)=>x(n)&&x(e)&&nn(n,e)>0,P=n=>!!n&&n!=="0"&&n.toLowerCase()!=="false";function en(n=process.env,e=""){return P(n.FLINT_NO_UPDATE)?"FLINT_NO_UPDATE is set":P(n.CI)?"running in CI":P(n.NO_UPDATE_NOTIFIER)?"NO_UPDATE_NOTIFIER is set":!x(e)||e.startsWith("0.0.0")?"development build":null}var $=(n=process.env)=>n.FLINT_UPDATE_DIR||d().join(D(),".flintmaker");function b(n=$()){try{let e=JSON.parse(U(d().join(n,"update.json"),"utf8"));return e&&typeof e=="object"?e:{}}catch{return{}}}function p(n,e=$()){try{T(e,{recursive:!0,mode:448}),w(d().join(e,"update.json"),JSON.stringify(n,null,2)+`
|
|
2
2
|
`)}catch{}}var tn=(n,e=Date.now())=>!n.checkedAt||e-n.checkedAt>=X||n.checkedAt>e;function rn(n,e={}){let r=e.platform??process.platform,t=d(r),o=u(r),s=e.env??process.env,i=e.exists??I,c=g=>o?t.normalize(g).toLowerCase():t.normalize(g),a=(g,W)=>c(g).startsWith(c(W).replace(/[\\/]+$/,"")+t.sep),l=t.normalize(n);if(c(l).split(t.sep).includes("_npx"))return{kind:"npx"};let N=`${t.sep}node_modules${t.sep}${f}${t.sep}`,j=c(l).lastIndexOf(c(N));if(j<0)return{kind:"dev"};let J=l.slice(0,j+N.length-f.length-2),h=t.dirname(J),V=e.home??D(),M=t.join(V,".flintmaker");if(a(l,M))return{kind:"flintmaker",prefix:M};if(o){let g=s.APPDATA?t.join(s.APPDATA,"npm"):null;return g&&c(h)===c(g)||i(t.join(h,"npm.cmd"))||i(t.join(h,"node.exe"))?{kind:"npm-global",prefix:h}:{kind:"local"}}return t.basename(h)==="lib"?{kind:"npm-global",prefix:t.dirname(h)}:{kind:"local"}}var E=(n,e=process.platform)=>u(e)?d(e).join(n,"node_modules"):d(e).join(n,"lib","node_modules");function on(n,e){let r=d(e),t=r.dirname(n);return u(e)?r.join(t,"node_modules","npm","bin","npm-cli.js"):r.join(t,"..","lib","node_modules","npm","bin","npm-cli.js")}function S(n,e,r={}){if(n.kind!=="flintmaker"&&n.kind!=="npm-global"||!x(e))return null;let t=r.platform??process.platform,o=d(t),s=r.exists??I,i=["install","-g","--prefix",n.prefix,"--no-fund","--no-audit",`${f}@${e}`],c=[];n.kind==="flintmaker"&&c.push(u(t)?o.join(n.prefix,"node","node.exe"):o.join(n.prefix,"node","bin","node")),c.push(r.execPath??process.execPath);for(let a of c){let l=on(a,t);if(s(a)&&s(l))return{file:a,args:[l,...i],options:{windowsHide:!0}}}if(u(t)){let a=i.map(l=>/[\s&()^]/.test(l)?`"${l}"`:l).join(" ");return{file:r.env?.ComSpec||"cmd.exe",args:["/d","/s","/c",`"npm ${a}"`],options:{windowsVerbatimArguments:!0,windowsHide:!0}}}return{file:"npm",args:i,options:{}}}function H(n,e=process.platform){if(n.kind!=="flintmaker"&&n.kind!=="npm-global")return!1;try{return O(E(n.prefix,e),F.W_OK),u(e)||O(d(e).join(n.prefix,"bin"),F.W_OK),!0}catch{return!1}}function A(){try{return rn(Z(process.argv[1]??""))}catch{return{kind:"dev"}}}var k=(n,e)=>n.kind==="flintmaker"?`Update available v${e}: run flint update`:n.kind==="npx"?`Update available v${e}: run npx flintmaker@latest`:`Update available v${e}: run npm i -g ${f}`;async function C(n=3e3,e=process.env.FLINT_UPDATE_URL||Q){try{let r=await fetch(e,{signal:AbortSignal.timeout(n),headers:{accept:"application/json"}});if(!r.ok)return null;let t=await r.json();return x(t?.version)?t.version:null}catch{return null}}function sn(n){let e="dist/flint.js";if(typeof n=="string")e=n;else if(n&&typeof n=="object"){let r=n,t=r.flint??r.flintmaker??Object.values(r)[0];typeof t=="string"&&(e=t)}return e.replace(/^\.[\\/]/,"")}var y=["flint","flintmaker"];function an(n,e=process.platform){let r=d(e);return u(e)?y.flatMap(t=>["",".cmd",".ps1"].map(o=>r.join(n,t+o))):y.map(t=>r.join(n,"bin",t))}function cn(n,e,r=process.platform){let t=d(r);if(u(r)){let i=["@echo off","rem FlintMaker CLI launcher (written by https://flintmaker.com/install.ps1)","setlocal",'set "FM_HOME=%~dp0"','set "FM_NODE=node"','if exist "%FM_HOME%node\\node.exe" set "FM_NODE=%FM_HOME%node\\node.exe"','if exist "%FM_HOME%node\\node.exe" set "PATH=%FM_HOME%node;%PATH%"',`"%FM_NODE%" "%FM_HOME%node_modules\\flintmaker\\${e.replace(/\//g,"\\")}" %*`,""].join(`\r
|
|
3
3
|
`);return y.map(c=>({path:t.join(n,`${c}.cmd`),content:i}))}let o=i=>i.replace(/[\\"$`]/g,"\\$&"),s=`#!/bin/sh
|
|
4
4
|
# FlintMaker CLI launcher (written by https://flintmaker.com/install.sh)
|
package/dist/flint.js
CHANGED
|
@@ -21,7 +21,7 @@ import{a as ne,b as D,c as ie,d as re,e as R}from"./chunks/chunk-EUPBID7K.js";im
|
|
|
21
21
|
[\u2026 ${f} characters omitted \u2026]
|
|
22
22
|
`:"")+r).replace(/\r\n/g,`
|
|
23
23
|
`),u=m?"[interrupted by the user]":d?`[timed out after ${Math.round(n/1e3)}s]`:`[exit code ${x}]`;i(`${E.slice(0,Fe)}
|
|
24
|
-
${u}`.trim())}),s.on("error",x=>{clearTimeout(w),t?.removeEventListener("abort",y),i(`[could not run command: ${x.message}]`)})})}};var _="0.2.
|
|
24
|
+
${u}`.trim())}),s.on("error",x=>{clearTimeout(w),t?.removeEventListener("abort",y),i(`[could not run command: ${x.message}]`)})})}};var _="0.2.2",Ne=()=>`
|
|
25
25
|
${g.ember("\u2726")} ${g.bold(oe("FlintMaker"))} ${g.bold("flint")} ${g.grey(`v${_}`)} ${g.grey("\u2014 the AI coding agent for your terminal")}
|
|
26
26
|
|
|
27
27
|
${g.bold("Usage")}
|
|
@@ -30,7 +30,7 @@ ${u}`.trim())}),s.on("error",x=>{clearTimeout(w),t?.removeEventListener("abort",
|
|
|
30
30
|
flint login connect this computer to your FlintMaker account
|
|
31
31
|
flint logout disconnect
|
|
32
32
|
flint whoami show account and credits
|
|
33
|
-
flint update update flint now (it also updates itself
|
|
33
|
+
flint update update flint now (it also updates itself automatically)
|
|
34
34
|
|
|
35
35
|
${g.bold("Options")}
|
|
36
36
|
--smart use the Smart model (paid plans, more credits)
|
|
@@ -43,7 +43,7 @@ ${u}`.trim())}),s.on("error",x=>{clearTimeout(w),t?.removeEventListener("abort",
|
|
|
43
43
|
@path attaches a file \xB7 shift+tab switches mode \xB7 esc interrupts
|
|
44
44
|
`;function Ie(o){let e=new Set(o.filter(t=>t.startsWith("--"))),n=o.filter(t=>!t.startsWith("--"));return{flags:e,rest:n}}async function ue(){let o=new N(R(null));console.log();let e=await o.deviceLogin((n,t)=>{console.log(` ${g.ember("\u2726")} Your code: ${g.bold(g.gold(n))}`),console.log(` ${g.grey("Opening")} ${t}`),console.log(` ${g.grey("Approve it in the browser. Waiting\u2026")}`),ne(t)});ie({token:e.token,email:e.user.email,api:o.base}),console.log(`
|
|
45
45
|
${g.green("\u2713")} Signed in as ${g.bold(e.user.email)}. Run ${g.bold("flint")} in any project folder.
|
|
46
|
-
`)}async function De(){let o="";process.stdin.setEncoding("utf8");for await(let e of process.stdin)o+=e;return o.trim()}function Re(){setTimeout(()=>{import("./chunks/update-
|
|
46
|
+
`)}async function De(){let o="";process.stdin.setEncoding("utf8");for await(let e of process.stdin)o+=e;return o.trim()}function Re(){setTimeout(()=>{import("./chunks/update-HPFBYAFF.js").then(o=>o.autoUpdate({current:_,notify:e=>le(e),preload:()=>Promise.all([import("./chunks/repl-LUJ6BCT7.js"),import("./chunks/plain-EQXWFHTX.js"),import("./chunks/highlight-QJIBHZTN.js")])})).catch(()=>{})},200).unref()}async function Me(){if(!ee())for(let m of[process.stdout,process.stderr])m.isTTY&&te(m);let{flags:o,rest:e}=Ie(process.argv.slice(2));if(o.has("--version")||o.has("-v"))return console.log(_);if(o.has("--help")||e[0]==="help"||e[0]==="-h")return console.log(Ne());if(e[0]==="login")return ue();if(e[0]==="__update"&&e[1]){let{updateWorker:m}=await import("./chunks/update-HPFBYAFF.js");return m(e[1])}if(e[0]==="update"&&e.length===1){let{updateNow:m}=await import("./chunks/update-HPFBYAFF.js");return m(_,h=>console.log(` ${h}`))}if(e[0]==="logout")return re(),console.log(`
|
|
47
47
|
Signed out. ${g.grey("Disconnect old terminals any time on your account page.")}
|
|
48
48
|
`);let n=!!process.stdin.isTTY&&!!process.stdout.isTTY;if(!D()){if(!n)return process.stderr.write(`flint: not signed in. Run: flint login
|
|
49
49
|
`),1;let{welcome:m,shortPath:h}=await import("./chunks/render-Q3KDKHPR.js"),{homedir:w}=await import("node:os"),y=Math.max(40,process.stdout.columns||80);console.log();let x={version:_,model:o.has("--smart")?"smart":"standard",cwd:h(process.cwd(),w(),28),status:"not signed in yet"};for(let E of m(x,y))console.log(E);console.log(`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flintmaker",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "flint
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"description": "flint \u2014 the FlintMaker AI coding agent for your terminal.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "PT Jiji Labs Digital",
|
|
7
7
|
"homepage": "https://flintmaker.com",
|