Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
342ffe3
chore(editorconfig): add indent style settings for csproj, resx, and …
Akeoott Dec 26, 2025
9dfb9cb
chore(readme): clarify WIP status and share whats planned for this pr…
Akeoott Dec 26, 2025
bb64450
chore(settings): update cSpell words list
Akeoott Dec 26, 2025
85db44c
Merge pull request #8 from Akeoott:chore/non-functional-changes
Akeoott Dec 26, 2025
0c6b4aa
remove(cli): delete obsolete cli project and implementation
Akeoott Dec 29, 2025
fd7dfcc
feat(backend): add argument parsing and terminal detection logic
Akeoott Dec 29, 2025
f9fe020
docs(readme): update badges, project description, and structure section
Akeoott Dec 29, 2025
ab111cd
refactor(backend/config): unify config section handling and add cssyn…
Akeoott Dec 29, 2025
5984259
refactor(backend): centralize help messages and update status handling
Akeoott Dec 30, 2025
1f3d294
refactor(backend): simplify cssync entry and prepare for execution flow
Akeoott Dec 30, 2025
544555a
refactor(backend): migrate config handling to Newtonsoft.Json and sim…
Akeoott Dec 31, 2025
3986bb2
docs: update HelpConfig instructions and add builds to .gitignore
Akeoott Dec 31, 2025
d7afbf2
fix(backend): update status check to use Json.GetConfigStatus and rem…
Akeoott Dec 31, 2025
6b91a67
feat(json, cssync) start implementing continuous Cssync loop based on…
Akeoott Dec 31, 2025
70c4edc
fix(docs): update README structure by wrapping badges in a div for be…
Akeoott Jan 2, 2026
df98ba9
Merge pull request #12 from Akeoott:refactor/program-usage
Akeoott Jan 2, 2026
061c35a
fix(readme): change INFO note to NOTE in README
Akeoott Jan 2, 2026
ce7940c
feat(templates): add pull request templates for branch merging and de…
Akeoott Jan 2, 2026
21a443f
Merge pull request #13 from Akeoott:refactor/github-templates
Akeoott Jan 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ indent_size = 4
[*.{md,txt}]
trim_trailing_whitespace = true
insert_final_newline = false

# Indent style for other files

[*.{csproj,resx,xml,json,jsonc}]
indent_style = space
indent_size = 2
44 changes: 44 additions & 0 deletions .github/pr_template_branch_to_dev.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
## Description

<!-- Provide a concise summary of what this PR does and why it's needed. -->

[Brief description of changes and purpose]

## Changes

<!-- List the key changes made in this PR. Use bullet points for clarity. -->

### New Features
- [Feature 1]
- [Feature 2]

### Bug Fixes
- [Fix 1 - describe issue]
- [Fix 2 - describe issue]

### Improvements
- [Improvement 1]
- [Improvement 2]

### Other
- [Any other changes]

## Additional Information

<!-- Include any other context, screenshots, deployment notes, or caveats reviewers should know. -->

### Issues
<!-- Link to any relevant issues -->
- Fixes #num
- Closes #num
- Related to #num

### Checklist
- [ ] Code follows project standards
- [ ] Documentation updated if required
- [ ] No breaking changes introduced
- [ ] Tests pass (if applicable)

---

**Note**: Keep changes focused and minimal. Don't add unrelated "improvements".
57 changes: 57 additions & 0 deletions .github/pr_template_dev_to_main.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Merge dev into main

## Summary
<!-- High-level overview of what this PR contains -->
[brief summary of major changes].

## Changes
<!-- Add Sections like code or docs depending on the changes -->
<!-- Order pull requests from lowest to highest number, aka first #8 then #9 then #10 -->

<!--
Available sections (use what's relevant, keep this order):
### Features
### Fixes
### Refactor
### Docs
### Workflow
### Other
-->

### Features
* `PullRequestUrl` by @`username`
* `PullRequestTitle`
* Key detail 1
* Key detail 2

### Fixes
* `PullRequestUrl` by @`username`
* `PullRequestTitle`
* What was fixed
* Impact of fix


<!-- Example: -->
<!--
# Merge dev into main
## Changes

### Feature
* https://github.com/Akeoott/cssync/pull/12 by @Akeoott
* Refactor core with logging, config system, and enhanced CLI
* Remove separate cssync.Cli project and integrate CLI functionality directly into backend
* Replace System.Text.Json with Newtonsoft.Json for flexible JObject-based configuration
* Implement dynamic config sections (Variables, Timers) instead of rigid dictionaries
* Add comprehensive argument parsing (--help, --status, --init) with categorized help system
* Introduce config-aware execution loop that responds to runtime changes
* Improve cross-platform terminal detection (Windows/Unix compatibility)
* Update README, .editorconfig, and .gitignore to reflect new architecture
* Add detailed configuration documentation via Resources.cs
### Docs and Workflow
* https://github.com/Akeoott/cssync/pull/8 by @Akeoott
* Improve documentation and add PR template
* Add some small changes to editorconfig, readme and vscode settings.
* Mainly for improving workspace configuration and adding more detail to readme.

etc...
-->
38 changes: 3 additions & 35 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,4 @@
## Description
Please go to the `Preview` tab and select the appropriate sub-template:

<!-- Provide a concise summary of what this PR does and why it's needed. -->

Description...

## Changes

<!-- List the key changes made in this PR. Use bullet points for clarity. -->

### New Features
-

### Bug Fixes
-

### Improvements
-

### Other
-

## Additional Information

<!-- Include any other context, screenshots, deployment notes, or caveats reviewers should know. -->

### Issues
<!-- Link to any relevant issues -->
- fixes #num
- closes #num
- resolves #num

### Checklist
- [ ] Code follows project standards
- [ ] Documentation updated if required
- [ ] Program compiles with no errors
* [Template for branch => dev](?expand=1&template=pr_template_branch_to_dev.md)
* [Template for dev => main](?expand=1&template=pr_template_dev_to_main.md)
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ StyleCopReport.xml
*.vspscc
*.vssscc
.builds
builds
*.pidb
*.svclog
*.scc
Expand Down
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
// cSpell
"cSpell.words": [
"cssync",
"initializers",
"isatty",
"konsole",
"libc",
"rclone"
"rclone",
"resx"
],
"cSpell.caseSensitive": true,
"cSpell.autoFormatConfigFile": true,
Expand Down
34 changes: 19 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
# cssync

| c | s | sync |
|:-----:|:-------:|:----:|
| Cloud | Storage | Sync |

<div>
<a>
<img src="https://img.shields.io/github/last-commit/Akeoott/cssync?style=for-the-badge&logoSize=auto&labelColor=%23201a19&color=%23ffb4a2"/>
</a>
<a>
<img src="https://img.shields.io/github/stars/Akeoott/cssync?style=for-the-badge&labelColor=%231d1b16&color=%23e6c419"/>
</a>
<a>
<img src="https://img.shields.io/github/repo-size/Akeoott/cssync?style=for-the-badge&labelColor=%231a1b1f&color=%23a8c7ff"/>
</a>
</div>
<br>

| c | s | sync |
|:-----:|:-------:|:----:|
| Cloud | Storage | Sync |

> [!WARNING]
> This project is WIP
> This project is WIP and POC

Written in C# for simplicity, performance and safety.<br>
Aiming for cross platform compatibility and support for various cloud storage services.

## Structure

This project is separated in to parts.

Cloud Storage Sync (cssync).<br>
Written in C# for performance and safety,<br>
aiming for cross platform compatibility for various cloud storage services using rclone.
| cssync.Backend | cssync.Gui |
|:---------------------:|:---------------------------:|
| Handles all the logic | Handle user input |
| Allow cli access | Provide graphical interface |

| cssync.Backend | cssync.Cli / cssync.Gui |
|:--------------:|:-----------------------:|
| Handles logic | Handle user input |
> [!NOTE]
> The backend is currently in development and the GUI will come in the future.
15 changes: 0 additions & 15 deletions cssync.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cssync.Backend", "src\cssync.Backend\cssync.Backend.csproj", "{7B696CFB-B168-4EF0-9152-9F12A7728080}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cssync.Cli", "src\cssync.Cli\cssync.Cli.csproj", "{FAB0E13E-20E0-4AD6-8F44-F79D952DFD1A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -31,24 +29,11 @@ Global
{7B696CFB-B168-4EF0-9152-9F12A7728080}.Release|x64.Build.0 = Release|Any CPU
{7B696CFB-B168-4EF0-9152-9F12A7728080}.Release|x86.ActiveCfg = Release|Any CPU
{7B696CFB-B168-4EF0-9152-9F12A7728080}.Release|x86.Build.0 = Release|Any CPU
{FAB0E13E-20E0-4AD6-8F44-F79D952DFD1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FAB0E13E-20E0-4AD6-8F44-F79D952DFD1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FAB0E13E-20E0-4AD6-8F44-F79D952DFD1A}.Debug|x64.ActiveCfg = Debug|Any CPU
{FAB0E13E-20E0-4AD6-8F44-F79D952DFD1A}.Debug|x64.Build.0 = Debug|Any CPU
{FAB0E13E-20E0-4AD6-8F44-F79D952DFD1A}.Debug|x86.ActiveCfg = Debug|Any CPU
{FAB0E13E-20E0-4AD6-8F44-F79D952DFD1A}.Debug|x86.Build.0 = Debug|Any CPU
{FAB0E13E-20E0-4AD6-8F44-F79D952DFD1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FAB0E13E-20E0-4AD6-8F44-F79D952DFD1A}.Release|Any CPU.Build.0 = Release|Any CPU
{FAB0E13E-20E0-4AD6-8F44-F79D952DFD1A}.Release|x64.ActiveCfg = Release|Any CPU
{FAB0E13E-20E0-4AD6-8F44-F79D952DFD1A}.Release|x64.Build.0 = Release|Any CPU
{FAB0E13E-20E0-4AD6-8F44-F79D952DFD1A}.Release|x86.ActiveCfg = Release|Any CPU
{FAB0E13E-20E0-4AD6-8F44-F79D952DFD1A}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{7B696CFB-B168-4EF0-9152-9F12A7728080} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{FAB0E13E-20E0-4AD6-8F44-F79D952DFD1A} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
EndGlobalSection
EndGlobal
52 changes: 32 additions & 20 deletions src/cssync.Backend/Cssync.cs
Original file line number Diff line number Diff line change
@@ -1,32 +1,44 @@
// Copyright (c) Ame (Akeoott) <ame@akeoot.org>. Licensed under the GPLv3 License.
// See the LICENSE file in the repository root for full license text.

using Newtonsoft.Json.Linq;

using cssync.Backend.helper;

namespace cssync.Backend;

/// <summary>
/// Reads config and acts on the data it contains
/// </summary>
public static class Cssync
{
internal const string cssyncOptions = """
Usage:
> cssync [option] [scope] [args]
Options:
> cssync help | See all options
> cssync list | Display entire json config
> cssync run | Run a variable
> cssync edit | Edit a value in config
> cssync append | Append a value to config
> cssync remove | Remove a value from config
Scopes:
help | See usage and expanded info for each option
variables | Configure your Variables (rclone command presets)
timer | Configure the Timer (when commands periodically execute)
""";

public static async Task<string> RunCssync(string option = "help", string? scope = null, params string[] args)
public static async Task RunCssync()
{
if (!await Json.GetConfigStatus())
{
Log.Info("cssync is currently disabled by config");
}

var cts = new CancellationTokenSource();
var token = cts.Token;

Task task = Task.Run(() => CssyncLoop(token), token);

while (true)
{
if (!await Json.GetConfigStatus())
{
cts.Cancel();
await Task.WhenAll(task);
Log.Info("cssync was stopped by config");
return;
}
await Task.Delay(5000);
}
}

private static async Task CssyncLoop(CancellationToken token)
{
string warningMsg = "Cssync has not been implemented yet! Please check the main branch out for the latest updates.";
Log.Warn(warningMsg);
return warningMsg;
// TODO
}
}
56 changes: 52 additions & 4 deletions src/cssync.Backend/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,63 @@

using cssync.Backend.helper;

using System.Diagnostics;
using System.Runtime.InteropServices;

namespace cssync.Backend;

internal class MainBackend
{
internal static async Task Main()
[DllImport("libc")]
private static extern int isatty(int fd);
public static async Task<bool> HasTerminal()
{
try
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return !Console.IsOutputRedirected && !Console.IsInputRedirected;
}
else
{
return isatty(0) == 1; // stdin
}
}
catch
{
return false;
}
}

internal static async Task Main(string[] args)
{
// NOTE: Backend may or may not become completely independent for automated use.
// As long as thats no the case, this may stay unchanged.
// TODO: Rewrite pending once appropriate...
if (!await HasTerminal())
{
Log.Critical("This program must be run from a terminal.");
Thread.Sleep(1000);
return;
}

Log.Debug("Current process: {ProcessName}", Process.GetCurrentProcess());
switch (args.Length)
{
case 0:
ParseInput.NoArguments();
break;

case 1:
await ParseInput.SingleArgument(args[0]);
break;

case 2:
await ParseInput.TwoArguments(args[0], args[1]);
break;

default:
Console.WriteLine($"Too many arguments. Use --help for usage.");
break;
}

// await Cssync.RunCssync();
}
}
Loading
Loading