@tsuzuku/arise 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cli.js CHANGED
@@ -33,6 +33,7 @@ Agent Skill Arguments:
33
33
  --local, --workspace Install skill locally to current workspace (.agents/skills).
34
34
 
35
35
  General Arguments:
36
+ --yes, -y (Optional) Automatically answer yes to confirmation prompts (e.g. installing Herdr).
36
37
  --help, -h Show this help message.
37
38
  --version, -v Show version information.
38
39
  `);
@@ -45,6 +46,7 @@ function parseArgs(argv = process.argv.slice(2)) {
45
46
  dirOnly: false,
46
47
  keepRemote: false,
47
48
  force: false,
49
+ yes: false,
48
50
  branch: null,
49
51
  dirname: null,
50
52
  workspaceName: null,
@@ -84,6 +86,8 @@ function parseArgs(argv = process.argv.slice(2)) {
84
86
  flags.keepRemote = true;
85
87
  } else if (arg === '--force' || arg === '-f') {
86
88
  flags.force = true;
89
+ } else if (arg === '--yes' || arg === '-y') {
90
+ flags.yes = true;
87
91
  } else if (arg === '--branch' || arg === '-b') {
88
92
  flags.branch = argv[i + 1];
89
93
  i++;
package/lib/herdr.js CHANGED
@@ -1,4 +1,101 @@
1
1
  const { execSync, spawnSync } = require('child_process');
2
+ const path = require('path');
3
+ const os = require('os');
4
+ const readline = require('readline');
5
+
6
+ function isCommandAvailable(cmd) {
7
+ try {
8
+ const checkCmd = process.platform === 'win32' ? `where ${cmd}` : `command -v ${cmd}`;
9
+ execSync(checkCmd, { stdio: 'ignore' });
10
+ return true;
11
+ } catch {
12
+ return false;
13
+ }
14
+ }
15
+
16
+ function isHerdrInstalled() {
17
+ const localBin = path.join(os.homedir(), '.local', 'bin');
18
+ if (process.env.PATH && !process.env.PATH.split(path.delimiter).includes(localBin)) {
19
+ process.env.PATH = `${localBin}${path.delimiter}${process.env.PATH}`;
20
+ }
21
+ return isCommandAvailable('herdr');
22
+ }
23
+
24
+ function getRecommendedInstallCommand() {
25
+ if (process.platform === 'darwin' && isCommandAvailable('brew')) {
26
+ return {
27
+ name: 'Homebrew',
28
+ cmd: 'brew install herdr',
29
+ docsUrl: 'https://herdr.dev/docs/install/#install-with-homebrew',
30
+ };
31
+ }
32
+ if (isCommandAvailable('mise')) {
33
+ return {
34
+ name: 'mise',
35
+ cmd: 'mise use -g herdr',
36
+ docsUrl: 'https://herdr.dev/docs/install/#install-with-mise',
37
+ };
38
+ }
39
+ if (process.platform === 'win32') {
40
+ return {
41
+ name: 'PowerShell Installer',
42
+ cmd: 'powershell -ExecutionPolicy Bypass -c "irm https://herdr.dev/install.ps1 | iex"',
43
+ docsUrl: 'https://herdr.dev/docs/install/',
44
+ };
45
+ }
46
+ return {
47
+ name: 'Official Install Script',
48
+ cmd: 'curl -fsSL https://herdr.dev/install.sh | sh',
49
+ docsUrl: 'https://herdr.dev/docs/install/',
50
+ };
51
+ }
52
+
53
+ function promptUser(question) {
54
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
55
+ return new Promise((resolve) => {
56
+ rl.question(question, (answer) => {
57
+ rl.close();
58
+ resolve(answer.trim());
59
+ });
60
+ });
61
+ }
62
+
63
+ async function ensureHerdrInstalled(options = {}) {
64
+ if (isHerdrInstalled()) {
65
+ return true;
66
+ }
67
+
68
+ const { name, cmd, docsUrl } = getRecommendedInstallCommand();
69
+ const autoConfirm = Boolean(options.yes);
70
+
71
+ if (!autoConfirm && (!process.stdin.isTTY || process.env.CI)) {
72
+ console.error(`\n[arise] Error: "herdr" is required to manage terminal workspaces but was not found in PATH.`);
73
+ console.error(`Please install Herdr before running arise:\n ${cmd}\n`);
74
+ console.error(`Docs: ${docsUrl || 'https://herdr.dev/docs/install/'}`);
75
+ process.exit(1);
76
+ }
77
+
78
+ if (!autoConfirm) {
79
+ console.log(`\n[arise] "herdr" is required to manage terminal workspaces but was not found in PATH.`);
80
+ const answer = await promptUser(`Would you like arise to install Herdr now via ${name} (\`${cmd}\`)? [Y/n]: `);
81
+ if (answer && !/^(y|yes)$/i.test(answer)) {
82
+ console.error('\nCannot proceed without Herdr. Aborting.');
83
+ process.exit(1);
84
+ }
85
+ }
86
+
87
+ console.log(`\n==> Installing Herdr via ${name}...`);
88
+ const result = spawnSync(cmd, { stdio: 'inherit', shell: true });
89
+
90
+ if (result.status !== 0 || !isHerdrInstalled()) {
91
+ console.error(`\n[arise] Failed to automatically install Herdr.`);
92
+ console.error(`Please visit https://herdr.dev/docs/install/ to install manually.`);
93
+ process.exit(1);
94
+ }
95
+
96
+ console.log(`[arise] Herdr installed successfully!\n`);
97
+ return true;
98
+ }
2
99
 
3
100
  function parseJsonFromOutput(output) {
4
101
  if (!output) return null;
@@ -105,6 +202,9 @@ function attachOrSwitchSession(sessionName) {
105
202
  }
106
203
 
107
204
  module.exports = {
205
+ isHerdrInstalled,
206
+ getRecommendedInstallCommand,
207
+ ensureHerdrInstalled,
108
208
  listWorkspaces,
109
209
  createWorkspace,
110
210
  closeWorkspace,
@@ -91,6 +91,8 @@ async function executeCreate(flags, config, cwd = process.cwd()) {
91
91
  }
92
92
 
93
93
  // 7. Orchestrate Herdr Workspace
94
+ await herdr.ensureHerdrInstalled({ yes: flags.yes });
95
+
94
96
  console.log(`\n==> Creating Herdr workspace "${sessionName}"...`);
95
97
  let ws;
96
98
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsuzuku/arise",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/types.d.ts CHANGED
@@ -11,6 +11,7 @@ export interface CliFlags {
11
11
  dirOnly: boolean;
12
12
  keepRemote: boolean;
13
13
  force: boolean;
14
+ yes: boolean;
14
15
  branch: string | null;
15
16
  dirname: string | null;
16
17
  workspaceName: string | null;