@telepath-computer/stash 0.2.3 → 0.3.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 CHANGED
@@ -11,15 +11,24 @@ npm install -g @telepath-computer/stash
11
11
  Set up GitHub access and connect the current directory:
12
12
 
13
13
  ```bash
14
- stash background install
15
- stash init
16
14
  stash setup github
17
- stash connect github --repo user/repo --background
15
+ stash connect github --repo user/repo
16
+ stash start
18
17
  ```
19
18
 
20
- You can initialize a directory explicitly with `stash init`, or let `stash connect` create `.stash/` for you automatically.
19
+ You'll need a GitHub personal access token. We recommend a **fine-grained token** scoped to only the repos you use with stash.
21
20
 
22
- You'll need a GitHub [personal access token](https://github.com/settings/tokens). A classic token needs the `repo` scope. A fine-grained token needs **Contents: Read and write** permission on the target repo.
21
+ ### Creating a GitHub Token
22
+
23
+ 1. Go to [github.com/settings/personal-access-tokens/new](https://github.com/settings/personal-access-tokens/new)
24
+ 2. Give it a name (e.g. `stash`)
25
+ 3. Under **Repository access**, select **Only select repositories** and pick the repo(s) you'll sync
26
+ 4. Under **Repository permissions**, set **Contents** to **Read and write**
27
+ 5. Click **Generate token** and copy it
28
+
29
+ Use this token when running `stash setup github`.
30
+
31
+ > A classic token with the `repo` scope also works, but grants broader access than necessary.
23
32
 
24
33
  ## How It Works
25
34
 
@@ -31,28 +40,37 @@ You'll need a GitHub [personal access token](https://github.com/settings/tokens)
31
40
  ## Commands
32
41
 
33
42
  ```bash
34
- stash background install
35
- stash background add
36
- stash init
37
43
  stash setup github
38
- stash connect github --repo user/repo --background
44
+ stash connect github --repo user/repo
45
+ stash start
46
+ stash stop
39
47
  stash sync
40
48
  stash watch
41
- stash background status
42
49
  stash status
50
+ stash status --all
51
+ stash disconnect
43
52
  stash disconnect github
44
- stash background remove
45
- stash background uninstall
46
53
  ```
47
54
 
48
55
  `stash watch` keeps the directory in sync continuously. Press `.` to trigger an immediate sync and `q` to quit.
49
56
 
50
- `stash background install` plus `stash connect --background` gives you boot-time background syncing managed by `launchd` on macOS or `systemd` on Linux.
57
+ `stash start` enables boot-time background syncing managed by `launchd` on macOS or `systemd` on Linux. Connected stashes are registered automatically.
58
+
59
+ `stash disconnect` removes the current stash completely. `stash disconnect <provider>` removes one provider connection and removes `.stash/` too if that was the last one.
60
+
61
+ Typical `stash start` output:
62
+
63
+ ```text
64
+ Background sync is on
65
+ Watching 1 stash · starts on startup
66
+ ```
51
67
 
52
68
  ## Config
53
69
 
54
70
  - Global config lives at `~/.stash/config.json` or `$XDG_CONFIG_HOME/stash/config.json`.
55
- - Per-stash connection config lives at `.stash/config.local.json` inside the synced directory.
71
+ - Per-stash config lives at `.stash/config.json` inside the synced directory.
72
+
73
+ Older prerelease stashes using `.stash/config.local.json` and `.stash/snapshot.local/` are migrated automatically on startup.
56
74
 
57
75
  Example global config:
58
76
 
@@ -71,6 +89,7 @@ Example global config:
71
89
 
72
90
  - `docs/api.md` - developer-facing `Stash` and provider contracts
73
91
  - `docs/architecture.md` - core components and repo boundaries
92
+ - `docs/config.md` - config locations, metadata files, and config key conventions
74
93
  - `docs/sync.md` - sync lifecycle, locking, drift, and snapshot semantics
75
94
  - `docs/reconciliation.md` - merge and file-resolution rules
76
95
  - `docs/cli.md` - user-facing CLI behavior
@@ -87,6 +106,12 @@ Not blindly. On first sync, local and remote content are reconciled rather than
87
106
 
88
107
  Yes, but not on the same machine and directory. Stash syncs the working tree directly to `main` through the GitHub API and does not understand local git state.
89
108
 
109
+ ## Using Stash With Git
110
+
111
+ By default, stash refuses to sync a directory that contains `.git/`. Branch switches look like mass file edits to stash, so syncing inside a git working tree can push destructive changes to the remote.
112
+
113
+ If you do not need git in that directory, remove `.git/`. If you intentionally want both, run `stash config set allow-git true` first, then keep stash pinned to one branch and do not switch branches while stash is active.
114
+
90
115
  **Does stash use branches or PRs?**
91
116
 
92
117
  No. Stash reads and writes the `main` branch directly.
@@ -7,6 +7,10 @@ type ServiceHandle = {
7
7
  running: boolean;
8
8
  }>;
9
9
  };
10
+ type ServiceLaunch = {
11
+ command: string;
12
+ args: string[];
13
+ };
10
14
  type CliDependencies = {
11
15
  cwd?: () => string;
12
16
  readGlobalConfig?: () => Promise<GlobalConfig>;
@@ -16,7 +20,7 @@ type CliDependencies = {
16
20
  stdout?: NodeJS.WriteStream;
17
21
  stderr?: NodeJS.WriteStream;
18
22
  };
19
- export declare function resolveStashCommand(): Promise<string>;
23
+ export declare function resolveServiceLaunch(argv?: string[]): Promise<ServiceLaunch>;
20
24
  export declare function main(argv?: string[], deps?: CliDependencies): Promise<void>;
21
25
  export {};
22
26
  //# sourceMappingURL=cli-main.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli-main.d.ts","sourceRoot":"","sources":["../src/cli-main.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAS,YAAY,EAAiB,MAAM,YAAY,CAAC;AAKrE,KAAK,aAAa,GAAG;IACnB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,MAAM,IAAI,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAC7D,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/C,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC;CAC7B,CAAC;AAkCF,wBAAsB,mBA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