Commit Graph

483 Commits

Author SHA1 Message Date
KernelDeimos
c0063a871f fix: handling of batch requests with zero files 2024-07-02 15:38:56 -04:00
Sam Atkins
75a989a7b6 feat(phoenix): Make clear clear scrollback unless -x is given
From what I understand, we shouldn't need both `\x1B[2J` and `\x1B[3J`
sequences to clear everything, but xterm.js would not correctly clear
the visible region with only `\x1B[3J`. So, we have both.
2024-07-01 13:59:43 -04:00
Sam Atkins
d76e7130cb fix(phoenix): Gracefully handle completing a non-existent path
filesystem.readdir() can throw, which previously would crash Phoenix and
leave the terminal unresponsive. This change makes it return no results
instead.
2024-07-01 13:52:46 -04:00
Sam Atkins
4539408a21 feat(phoenix): Show actual host name in prompt and neofetch 2024-07-01 12:46:15 -04:00
Sam Atkins
e2ea57fcf9 tweak(phoenix): Only take auth params from config message
Having the parent app send us arbitrary config values was a holdover
from when phoenix was an embedded iframe and not a separate app. It led
to a security issue previously. Let's only take the auth parameters
since we can't get those otherwise, and they're safe to read.
Everything else should be available in our own URL params.
2024-07-01 12:46:15 -04:00
KernelDeimos
2f5b9cc4ee chore: add temp user-app permission 2024-06-30 16:40:25 -04:00
KernelDeimos
2f163221bd fix: update PD alert custom details 2024-06-30 16:31:02 -04:00
KernelDeimos
1429d6f57c fix: column nullability blunder 2024-06-30 15:06:10 -04:00
KernelDeimos
b10302ad74 fix: add missing columns for public directory update 2024-06-28 22:26:57 -04:00
KernelDeimos
9ad04cd33f prereq: make it possible to access storage without context init 2024-06-28 17:43:45 -04:00
Sam Atkins
d077504f9b doc(git): Expand documentation and add FIXMEs 2024-06-28 14:19:23 -04:00
Sam Atkins
711dbc0d2f feat(git): Understand references like HEAD^ and main~3
There are a lot of ways of specifying a revision, but these are a couple
of common ones.
2024-06-28 14:19:23 -04:00
Sam Atkins
adcd3db0ed refactor: Move parsely into top-level packages directory
Parsely was missed by fa7bec3854 because
it got merged afterwards.
2024-06-28 14:19:23 -04:00
Sam Atkins
45cdfcb5bf feat(git): Display ref names in git log and git show 2024-06-28 14:19:23 -04:00
Sam Atkins
351d3f50ba tweak(git): List git subcommands in git help with no arguments 2024-06-28 14:19:23 -04:00
Sam Atkins
73d0f5a90c fix(git): Make git commit display detached HEAD correctly 2024-06-28 14:19:23 -04:00
Sam Atkins
dd10a37749 feat(git): Make shorten_hash() guaranteed to produce a unique hash
Until now we just relied on it being very unlikely that there would be a
collision. This new method ensures that the returned hash is unique.
2024-06-28 14:19:23 -04:00
Sam Atkins
fa3df72f6e feat(git): Add a --debug option, which sets the DEBUG global
I ended up removing the debugging code that used this, but it seems
useful anyway for future debug logs.
2024-06-28 14:19:23 -04:00
Sam Atkins
2e4259d267 feat(git): Implement git cherry-pick
This is quite manual, and only handles the simple cases where no merge
conflicts occur. Should be useful for basing a `rebase` command off of
though.
2024-06-28 14:19:23 -04:00
Sam Atkins
bab5204209 feat(git): Color output for git status files
Matching canonical git, staged changes are green and unstaged/untracked
are red.
2024-06-28 14:19:23 -04:00
Sam Atkins
4ba8a32b45 feat(git): Implement git restore
I tried implementing --source=foo too, but was bumping into weird
behaviour with isomorphic-git, so I've removed that for now. Eventually
we'll want it, but it seems fairly niche.
2024-06-28 14:19:23 -04:00
Sam Atkins
a68037111a feat(git): Display file contents as a string for git show FILE_OID 2024-06-28 14:19:23 -04:00
Sam Atkins
b6906bbcaa feat(git): Resolve more forms of commit reference
Specifically, we previously didn't resolve short commit hashes into the
full ones.

These functions provide a single place to later add more ways of
selection a commit, such as `HEAD~1`.
2024-06-28 14:19:23 -04:00
Sam Atkins
60976b1ed6 feat(git): Format output closer to canonical git
Make some parts colored or bold, and indent commit messages.
2024-06-28 14:19:23 -04:00
Sam Atkins
955154468f feat(git): Make git add work for deleted files
Previously, this:

```sh
> rm deleted.txt
> git add deleted.txt
```

...would unhelpfully complain that deleted.txt cannot be found. Now, it
records the deleted file to the index, just as canonical git does.
2024-06-28 14:19:23 -04:00
Sam Atkins
057b3acf00 feat(git): Allow checking out a commit instead of a branch 2024-06-28 14:19:23 -04:00
Sam Atkins
2c9b1a3ffc feat(git): Handle detached HEAD in git status and git branch --list 2024-06-28 14:19:23 -04:00
Sam Atkins
d6dd1a5bb0 feat(git): Add --color and --no-color options
These allow the user to force color on or off. The chalk library is used
for the output, because it's already used elsewhere in Puter and seems
like a good choice.

Ideally, the default will be based on whether stdout is a tty, but Puter
doesn't yet have that concept, so we just default to color.
2024-06-28 14:19:23 -04:00
Sam Atkins
364d580ff8 feat(git): Add authentication to clone, fetch, and pull. 2024-06-28 14:19:23 -04:00
Sam Atkins
8c70229a18 feat(git): Implement git push
For now, the authentication is by --username and --password options,
which obviously is not good because the password is visible. But doing
it in a nicer way requires features that Phoenix or Puter are currently
missing.
2024-06-28 14:19:23 -04:00
Sam Atkins
3cad1ec436 feat(git): Add diff display to show and log subcommands 2024-06-28 14:19:23 -04:00
Sam Atkins
c436460b8c tweak(git): Move proxy url definition into config files
We'll likely want to host our own proxy. Self-hosters likewise may have
their own, but it's convenient to use isomorphic-git's for development.
2024-06-28 14:19:23 -04:00
Sam Atkins
a68194090e tweak(git): Check for 'ENOENT' instead of ErrorCodes.ENOENT
This is functionally the same, but removes one place where we
unnecessarily relied on Puter code.
2024-06-28 14:19:23 -04:00
Sam Atkins
c0562d78a2 docs(git): Document git client 2024-06-28 14:19:23 -04:00
Sam Atkins
622b6a9b92 feat(git): Implement git diff 2024-06-28 14:19:23 -04:00
Sam Atkins
49c2f16351 feat(git): Add start-revision and file arguments to git log 2024-06-28 14:19:23 -04:00
Sam Atkins
eb2b6a08b0 feat(git): Implement git pull 2024-06-28 14:19:23 -04:00
Sam Atkins
1822ace296 refactor(git): Use dir/gitdir variable names like isogit does
I prefer the other names, but being able to type `{ dir, gitdir }` is
shorter and a lot less error-prone than `{ dir: repository_dir, gitdir:
git_dir }`.
2024-06-28 14:19:23 -04:00
Sam Atkins
35e4453930 feat(git): Implement git checkout
For now this only lets you check out branches, not files.
2024-06-28 14:19:23 -04:00
Sam Atkins
98a4b9ede3 feat(git): Implement git fetch
Sporadically we hang while trying to fetch. I haven't been able to
identify why but it seems like a race condition in isomorphic-git
somewhere.
2024-06-28 14:19:23 -04:00
Sam Atkins
c86e4dfdce Remove unused imports from git subcommands 2024-06-28 14:19:23 -04:00
Sam Atkins
ad4f13255d feat(git): Implement git branch
Create, delete, copy, rename, and list branches.
2024-06-28 14:19:23 -04:00
Sam Atkins
43ce0d5b45 feat(git): Implement git remote 2024-06-28 14:19:23 -04:00
Sam Atkins
95c8235a4a feat(git): Implement git clone 2024-06-28 14:19:23 -04:00
Sam Atkins
fa81dca950 feat(backend): Add tab completion to server console command arguments
A command can optionally define a `completer(args)` function. It takes
an array of strings for the current arguments, and returns an array of
completion results for the last argument.

Includes a few completers:
- alarm:info/clear/inspect completes the first argument as an alarm id
  or short_id
- script:run completes the first argument as a script name
- params:get/set completes the first argument as a parameter name
2024-06-28 11:18:29 -04:00
Sam Atkins
e1e76c6be7 feat(backend): Add tab-completion to server console command names 2024-06-28 11:18:29 -04:00
KernelDeimos
ecb997885c fix: bug introduced when refactoring /share to Sequence 2024-06-27 18:27:20 -04:00
KernelDeimos
c374b0cbca feat: add group permission endpoints 2024-06-27 18:27:20 -04:00
KernelDeimos
4216346384 feat: add group management endpoints 2024-06-27 18:27:20 -04:00
KernelDeimos
00149402e0 feat: add user-group permission check 2024-06-27 18:27:20 -04:00