dayshift 0.0.0-stage → 0.1.1
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 +11 -2
- package/bin/dayshift.js +85 -0
- package/package.json +31 -4
package/README.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dayshift
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Instala e abre o [Dayshift](https://github.com/zaiinehaniel/dayshift), o app para Mac que roda seus agentes de código
|
|
4
|
+
(Claude Code, Codex, Gemini CLI, OpenCode) em tarefas paralelas.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npx dayshift # instala e abre
|
|
8
|
+
npm i -g dayshift # ou deixa o comando instalado
|
|
9
|
+
dayshift update
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
O app vai para `/Applications` (ou `~/Applications`, se não der para escrever lá). Ele se atualiza sozinho depois.
|
package/bin/dayshift.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Instala, atualiza e abre o Dayshift.app a partir da última versão publicada no GitHub.
|
|
3
|
+
// Baixado por aqui (e não pelo navegador), o app não ganha a quarentena do macOS e abre sem aviso.
|
|
4
|
+
import { execFileSync, spawnSync } from 'node:child_process';
|
|
5
|
+
import { accessSync, constants, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
6
|
+
import { homedir, tmpdir, arch } from 'node:os';
|
|
7
|
+
import { join } from 'node:path';
|
|
8
|
+
|
|
9
|
+
const LATEST = process.env.DAYSHIFT_LATEST || 'https://github.com/zaiinehaniel/dayshift/releases/latest/download/latest.json';
|
|
10
|
+
const APP = 'Dayshift.app';
|
|
11
|
+
const PLATFORM = arch() === 'arm64' ? 'darwin-aarch64' : 'darwin-x86_64';
|
|
12
|
+
|
|
13
|
+
function appDir() {
|
|
14
|
+
if (process.env.DAYSHIFT_DIR) return process.env.DAYSHIFT_DIR;
|
|
15
|
+
try { accessSync('/Applications', constants.W_OK); return '/Applications'; } catch { return join(homedir(), 'Applications'); }
|
|
16
|
+
}
|
|
17
|
+
function installedAt() {
|
|
18
|
+
const dirs = process.env.DAYSHIFT_DIR ? [process.env.DAYSHIFT_DIR] : ['/Applications', join(homedir(), 'Applications')];
|
|
19
|
+
return dirs.map(d => join(d, APP)).find(existsSync);
|
|
20
|
+
}
|
|
21
|
+
function installedVersion(app) {
|
|
22
|
+
try { return execFileSync('/usr/bin/defaults', ['read', join(app, 'Contents/Info'), 'CFBundleShortVersionString'], { encoding: 'utf8' }).trim(); } catch { return null; }
|
|
23
|
+
}
|
|
24
|
+
async function get(url) {
|
|
25
|
+
const res = await fetch(url, { headers: { 'user-agent': 'dayshift-installer' } });
|
|
26
|
+
if (!res.ok) throw new Error(`${res.status} ao baixar ${url}`);
|
|
27
|
+
return res;
|
|
28
|
+
}
|
|
29
|
+
async function install({ force = false } = {}) {
|
|
30
|
+
if (process.platform !== 'darwin') throw new Error('O Dayshift ainda é só para macOS.');
|
|
31
|
+
const latest = await (await get(LATEST)).json();
|
|
32
|
+
const entry = latest.platforms && latest.platforms[PLATFORM];
|
|
33
|
+
if (!entry) throw new Error(`A versão ${latest.version} não tem build para ${PLATFORM}.`);
|
|
34
|
+
const current = installedAt();
|
|
35
|
+
if (current && !force && installedVersion(current) === latest.version) {
|
|
36
|
+
console.log(`Dayshift ${latest.version} já está instalado em ${current}.`);
|
|
37
|
+
return current;
|
|
38
|
+
}
|
|
39
|
+
console.log(`Baixando o Dayshift ${latest.version}…`);
|
|
40
|
+
const tmp = mkdtempSync(join(tmpdir(), 'dayshift-'));
|
|
41
|
+
try {
|
|
42
|
+
const file = join(tmp, 'Dayshift.app.tar.gz');
|
|
43
|
+
writeFileSync(file, Buffer.from(await (await get(entry.url)).arrayBuffer()));
|
|
44
|
+
execFileSync('/usr/bin/tar', ['-xzf', file, '-C', tmp]);
|
|
45
|
+
const dir = appDir();
|
|
46
|
+
mkdirSync(dir, { recursive: true });
|
|
47
|
+
const target = join(dir, APP);
|
|
48
|
+
rmSync(target, { recursive: true, force: true });
|
|
49
|
+
execFileSync('/usr/bin/ditto', [join(tmp, APP), target]);
|
|
50
|
+
console.log(`Pronto: ${target}`);
|
|
51
|
+
return target;
|
|
52
|
+
} finally {
|
|
53
|
+
rmSync(tmp, { recursive: true, force: true });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function open(app) { spawnSync('/usr/bin/open', [app], { stdio: 'inherit' }); }
|
|
57
|
+
// `dayshift .` e `dayshift . texto da tarefa`: repassa para o comando que vem dentro do app.
|
|
58
|
+
async function cli(args) {
|
|
59
|
+
let app = installedAt() || await install();
|
|
60
|
+
let sh = join(app, 'Contents/Resources/dayshift');
|
|
61
|
+
if (!existsSync(sh)) { app = await install({ force: true }); sh = join(app, 'Contents/Resources/dayshift'); }
|
|
62
|
+
process.exitCode = spawnSync(sh, args, { stdio: 'inherit' }).status ?? 1;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const HELP = `Dayshift: seus agentes de código num só lugar.
|
|
66
|
+
|
|
67
|
+
dayshift instala (se faltar) e abre o app
|
|
68
|
+
dayshift . abre o projeto desta pasta, para criar uma tarefa
|
|
69
|
+
dayshift . <tarefa> cria a tarefa direto (--na-pasta: sem branch)
|
|
70
|
+
dayshift update baixa a versão mais nova
|
|
71
|
+
dayshift uninstall remove o app (suas tarefas e ajustes ficam)
|
|
72
|
+
dayshift --version versão instalada`;
|
|
73
|
+
|
|
74
|
+
const cmd = process.argv[2];
|
|
75
|
+
try {
|
|
76
|
+
if (cmd === '-h' || cmd === '--help' || cmd === 'help') console.log(HELP);
|
|
77
|
+
else if (cmd === '-v' || cmd === '--version') { const app = installedAt(); console.log(app ? installedVersion(app) : 'não instalado'); }
|
|
78
|
+
else if (cmd === 'update' || cmd === 'install') await install({ force: cmd === 'update' && process.argv.includes('--force') });
|
|
79
|
+
else if (cmd === 'uninstall') { const app = installedAt(); if (app) { rmSync(app, { recursive: true, force: true }); console.log(`Removido: ${app}`); } else console.log('O Dayshift não está instalado.'); }
|
|
80
|
+
else if (!cmd) open(installedAt() || await install());
|
|
81
|
+
else await cli(process.argv.slice(2));
|
|
82
|
+
} catch (e) {
|
|
83
|
+
console.error('Não deu certo: ' + e.message);
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dayshift",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Instala e abre o Dayshift: seus agentes de código (Claude Code, Codex) em tarefas paralelas, num app nativo para Mac.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"dayshift": "bin/dayshift.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin"
|
|
11
|
+
],
|
|
12
|
+
"os": [
|
|
13
|
+
"darwin"
|
|
14
|
+
],
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=18"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"claude-code",
|
|
20
|
+
"codex",
|
|
21
|
+
"ai-agents",
|
|
22
|
+
"macos",
|
|
23
|
+
"worktree",
|
|
24
|
+
"terminal"
|
|
25
|
+
],
|
|
26
|
+
"homepage": "https://github.com/zaiinehaniel/dayshift",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/zaiinehaniel/dayshift.git",
|
|
30
|
+
"directory": "npm"
|
|
31
|
+
},
|
|
32
|
+
"license": "MIT"
|
|
33
|
+
}
|