@tsuzuku/arise 1.0.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.
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: arise
3
+ description: User guide, CLI reference, and command executor for the `arise` utility (Git worktree and Herdr workspace orchestrator). Activate this skill whenever the user asks questions about how to use arise, how worktree orchestration works, how to configure `.ariserc.json` or `.worktreerc.json`, or asks the assistant to create, switch to, or nuke/clean up Git worktrees and Herdr workspaces on their behalf.
4
+ ---
5
+
6
+ # Arise Operator & Assistant Guide
7
+
8
+ Use this skill to answer questions about `arise` and run worktree management commands on the user's behalf.
9
+
10
+ ---
11
+
12
+ ## 1. CLI Quick Reference & Cheatsheet
13
+
14
+ ### Creating Worktrees
15
+ ```bash
16
+ # Create or open a worktree for a branch (auto-detects preset, boots Herdr workspace)
17
+ arise --branch <branch-name>
18
+
19
+ # Create worktree based off a specific base branch (e.g. develop, prod, main)
20
+ arise --branch <branch-name> --base <base-branch>
21
+
22
+ # Custom directory name or workspace name
23
+ arise -b <branch-name> -d <dir-name> -w <workspace-name>
24
+
25
+ # Explicit preset or pane focus ('agy', 'vim', 'logs', 'server', 'shell')
26
+ arise -b <branch-name> --preset laravel --focus agy
27
+ ```
28
+
29
+ ### Nuking / Teardown
30
+ ```bash
31
+ # Nuke active worktree (when run inside a worktree directory)
32
+ arise --nuke
33
+
34
+ # Nuke specific worktree by branch or directory name
35
+ arise --nuke <branch-or-dir>
36
+
37
+ # Remove directory only (keep local and remote git branches)
38
+ arise --nuke <target> --dir-only
39
+
40
+ # Delete local branch and directory, but keep remote branch on origin
41
+ arise --nuke <target> --keep-remote
42
+
43
+ # Force removal even if uncommitted changes exist
44
+ arise --nuke <target> --force
45
+ ```
46
+
47
+ ---
48
+
49
+ ## 2. Configuration (`.ariserc.json` / `.worktreerc.json` / `arise.config.js`)
50
+
51
+ Projects can configure custom topology, bare repos, and layouts via `.ariserc.json` or `.worktreerc.json` in the repository root or base directory:
52
+
53
+ ```json
54
+ {
55
+ "preset": "laravel",
56
+ "repo": {
57
+ "bareRepo": "/path/to/bare.git",
58
+ "worktreesBase": "/path/to/worktrees",
59
+ "defaultBaseBranch": "develop",
60
+ "protectedBranches": ["main", "master", "develop", "prod", "staging"]
61
+ },
62
+ "workspace": {
63
+ "labelPrefix": "[API] ",
64
+ "defaultFocus": "agy"
65
+ },
66
+ "scaffold": {
67
+ "envSource": "/path/to/shared/.env",
68
+ "symlink": "/path/to/webserver/symlink",
69
+ "install": "composer install --no-interaction"
70
+ }
71
+ }
72
+ ```
73
+
74
+ ---
75
+
76
+ ## 3. How to Assist the User
77
+
78
+ ### When the User Asks Questions:
79
+ 1. Consult the CLI options and configuration schema above.
80
+ 2. If working inside a repository with local documentation or `.ariserc.json` / `.worktreerc.json`, inspect those files.
81
+ 3. Provide clear explanations with executable CLI examples and config snippets.
82
+
83
+ ### When the User Asks You to Perform an Action:
84
+ 1. Formulate the appropriate `arise` CLI command.
85
+ 2. Execute the command on behalf of the user using the available command runner.
86
+ 3. Confirm the status of the created or nuked worktree and Herdr workspace.
package/types.d.ts ADDED
@@ -0,0 +1,151 @@
1
+ /**
2
+ * Arise - Type Definitions
3
+ *
4
+ * Provides strict structural contracts for presets, configuration,
5
+ * declarative layouts, execution context, and lifecycle hooks.
6
+ */
7
+
8
+ export interface CliFlags {
9
+ isCleanup: boolean;
10
+ cleanupTarget: string | null;
11
+ dirOnly: boolean;
12
+ keepRemote: boolean;
13
+ force: boolean;
14
+ branch: string | null;
15
+ dirname: string | null;
16
+ workspaceName: string | null;
17
+ source: string | null;
18
+ presetName: string | null;
19
+ focusTarget: string | null;
20
+ installSkill: boolean;
21
+ skillScope: 'global' | 'local' | null;
22
+ showHelp: boolean;
23
+ showVersion: boolean;
24
+ rawArgs: string[];
25
+ }
26
+
27
+ export type SplitDirection = 'right' | 'down';
28
+
29
+ export interface PaneDefinition {
30
+ /** Unique ID for the pane within this layout */
31
+ id: string;
32
+ /** Display title for the pane in Herdr */
33
+ title: string;
34
+ /** Command to execute upon creation (or null for empty shell) */
35
+ cmd: string | null;
36
+ /** Position if this is the root pane ('root') */
37
+ position?: 'root';
38
+ /** ID of parent pane from which to split */
39
+ from?: string;
40
+ /** Direction to split ('right' | 'down') */
41
+ split?: SplitDirection;
42
+ /** Whether to focus this pane by default */
43
+ focus?: boolean;
44
+ }
45
+
46
+ export interface RepoConfig {
47
+ /** Path to bare repository (if using bare git topology) */
48
+ bareRepo?: string | null;
49
+ /** Base directory where worktrees should be placed */
50
+ worktreesBase?: string | null;
51
+ /** Default base branch to branch off (e.g. 'develop', 'prod', 'main') */
52
+ defaultBaseBranch?: string;
53
+ /** Array of branch names protected against deletion */
54
+ protectedBranches?: string[];
55
+ }
56
+
57
+ export interface WorkspaceConfig {
58
+ /** Prefix added to Herdr workspace labels (e.g. '[BE] ') */
59
+ labelPrefix?: string;
60
+ /** Default pane to focus ('agy', 'vim', 'logs', 'server', 'shell') */
61
+ defaultFocus?: string;
62
+ }
63
+
64
+ export interface ScaffoldConfig {
65
+ /** Path to environment file (.env) to copy */
66
+ envSource?: string | null;
67
+ /** Target symlink path to point to the active worktree (e.g. '/var/www/my-app') */
68
+ symlink?: string | null;
69
+ /** Command to run to install dependencies upon creation, or false/null to skip installation */
70
+ install?: string | boolean | null;
71
+ [key: string]: any;
72
+ }
73
+
74
+ export interface ExecutionContext {
75
+ /** Target worktree absolute directory */
76
+ worktreePath: string;
77
+ /** Repository root directory */
78
+ repoRoot: string | null;
79
+ /** Bare repo directory (if applicable) */
80
+ bareRepo: string | null;
81
+ /** Target branch name */
82
+ branch: string;
83
+ /** Base source branch */
84
+ source: string;
85
+ /** Parsed CLI flags */
86
+ flags: CliFlags;
87
+ /** Active preset */
88
+ preset: Preset;
89
+ /** Merged configuration */
90
+ config: WorktreeConfig;
91
+
92
+ log(msg: string): void;
93
+ warn(msg: string): void;
94
+ error(msg: string): void;
95
+
96
+ /** Execute a shell command synchronously */
97
+ exec(command: string, options?: import('child_process').ExecSyncOptions): Buffer | string;
98
+ /** Spawn a process synchronously with stdio inherit */
99
+ spawn(command: string, args?: string[], options?: import('child_process').SpawnSyncOptions): import('child_process').SpawnSyncReturns<Buffer>;
100
+ /** Copy file from src to dst */
101
+ copyFile(src: string, dst: string): boolean;
102
+ /** Copy file from repository root to worktree destination */
103
+ copyFromRoot(relativeSrc: string, relativeDst?: string): boolean;
104
+ /** Safely create or replace a symlink */
105
+ setSymlink(symlinkPath: string, target?: string): boolean;
106
+ }
107
+
108
+ export interface PresetHooks {
109
+ /** Called to sync/reset primary branches before creation */
110
+ onSyncPrimary?(ctx: ExecutionContext): Promise<void> | void;
111
+ /** Called to scaffold environment, dependencies, and permissions */
112
+ onScaffold?(ctx: ExecutionContext): Promise<void> | void;
113
+ /** Called before deleting worktree and closing workspaces */
114
+ onPreNuke?(ctx: ExecutionContext): Promise<void> | void;
115
+ /** Called after all worktree and branch deletions complete */
116
+ onPostNuke?(ctx: ExecutionContext): Promise<void> | void;
117
+ }
118
+
119
+ export interface Preset {
120
+ /** Unique name of the preset ('node', 'laravel', 'generic') */
121
+ name: string;
122
+ /** Detection rule to determine if this preset applies to a directory */
123
+ detect?(cwd: string): boolean;
124
+ /** Repository defaults */
125
+ repo?: RepoConfig;
126
+ /** Workspace defaults */
127
+ workspace?: WorkspaceConfig;
128
+ /** Declarative terminal layout */
129
+ layout?: PaneDefinition[];
130
+ /** Scaffolding defaults */
131
+ scaffold?: ScaffoldConfig;
132
+ /** Lifecycle hook implementations */
133
+ hooks?: PresetHooks;
134
+ }
135
+
136
+ export interface WorktreeConfig {
137
+ /** Name of preset or preset object */
138
+ preset?: string | Preset;
139
+ /** Repository configuration */
140
+ repo: RepoConfig;
141
+ /** Workspace configuration */
142
+ workspace: WorkspaceConfig;
143
+ /** Declarative terminal layout */
144
+ layout: PaneDefinition[];
145
+ /** Scaffolding configuration */
146
+ scaffold: ScaffoldConfig;
147
+ /** Lifecycle hook overrides */
148
+ hooks: PresetHooks;
149
+ /** Path to config file that was loaded (if any) */
150
+ configFile?: string | null;
151
+ }
@@ -0,0 +1,112 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "HerdrWorktreeConfig",
4
+ "description": "Configuration schema for Herdr Worktree (.worktreerc.json)",
5
+ "type": "object",
6
+ "properties": {
7
+ "preset": {
8
+ "type": "string",
9
+ "description": "Preset name to use ('node', 'laravel', 'generic' or custom registered preset)"
10
+ },
11
+ "repo": {
12
+ "type": "object",
13
+ "description": "Repository topology and branch configuration",
14
+ "properties": {
15
+ "bareRepo": {
16
+ "type": ["string", "null"],
17
+ "description": "Path to bare git repository (e.g. '/path/to/bare/repo.git')"
18
+ },
19
+ "worktreesBase": {
20
+ "type": ["string", "null"],
21
+ "description": "Base directory where worktrees should be placed (e.g. '/path/to/worktrees')"
22
+ },
23
+ "defaultBaseBranch": {
24
+ "type": "string",
25
+ "description": "Default base branch to branch off (e.g. 'develop', 'prod', 'main')"
26
+ },
27
+ "protectedBranches": {
28
+ "type": "array",
29
+ "items": { "type": "string" },
30
+ "description": "Array of branch names protected against deletion during --nuke"
31
+ }
32
+ },
33
+ "additionalProperties": false
34
+ },
35
+ "workspace": {
36
+ "type": "object",
37
+ "description": "Herdr workspace naming and focus configuration",
38
+ "properties": {
39
+ "labelPrefix": {
40
+ "type": "string",
41
+ "description": "Prefix added to Herdr workspace labels (e.g. '[BE] ')"
42
+ },
43
+ "defaultFocus": {
44
+ "type": "string",
45
+ "description": "Default pane to focus upon creation ('agy', 'vim', 'logs', 'server', 'shell')"
46
+ }
47
+ },
48
+ "additionalProperties": false
49
+ },
50
+ "layout": {
51
+ "type": "array",
52
+ "description": "Declarative 4-pane quadrant layout definitions",
53
+ "items": {
54
+ "type": "object",
55
+ "required": ["id", "title"],
56
+ "properties": {
57
+ "id": {
58
+ "type": "string",
59
+ "description": "Unique identifier for this pane within the layout"
60
+ },
61
+ "title": {
62
+ "type": "string",
63
+ "description": "Title displayed on the Herdr pane"
64
+ },
65
+ "cmd": {
66
+ "type": ["string", "null"],
67
+ "description": "Command to run when pane is opened (e.g. 'vim .', 'npm run dev', 'tail -f ...')"
68
+ },
69
+ "position": {
70
+ "type": "string",
71
+ "enum": ["root"],
72
+ "description": "Set to 'root' for the initial root pane"
73
+ },
74
+ "from": {
75
+ "type": "string",
76
+ "description": "ID of parent pane to split from"
77
+ },
78
+ "split": {
79
+ "type": "string",
80
+ "enum": ["right", "down"],
81
+ "description": "Split direction ('right' or 'down')"
82
+ },
83
+ "focus": {
84
+ "type": "boolean",
85
+ "description": "Whether this pane should receive focus by default"
86
+ }
87
+ },
88
+ "additionalProperties": false
89
+ }
90
+ },
91
+ "scaffold": {
92
+ "type": "object",
93
+ "description": "Scaffolding options (environment files, symlinks, dependency installation, etc.)",
94
+ "properties": {
95
+ "envSource": {
96
+ "type": ["string", "null"],
97
+ "description": "Path to .env source file to copy into new worktree"
98
+ },
99
+ "symlink": {
100
+ "type": ["string", "null"],
101
+ "description": "Path to web server symlink to update to active worktree"
102
+ },
103
+ "install": {
104
+ "type": ["string", "boolean", "null"],
105
+ "description": "Command to run to install dependencies upon creation (e.g. 'npm install --legacy-peer-deps', 'pnpm install', 'composer install --no-interaction'), or false/null to skip installation."
106
+ }
107
+ },
108
+ "additionalProperties": true
109
+ }
110
+ },
111
+ "additionalProperties": false
112
+ }