rulesync 7.0.0 → 7.2.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.
Files changed (4) hide show
  1. package/README.md +155 -2
  2. package/dist/index.cjs +1280 -671
  3. package/dist/index.js +1276 -667
  4. package/package.json +14 -12
package/README.md CHANGED
@@ -126,6 +126,8 @@ rulesync init
126
126
 
127
127
  # Install official skills (recommended)
128
128
  rulesync fetch dyoshikawa/rulesync --features skills
129
+
130
+ # Or add skill sources to rulesync.jsonc and run 'rulesync install' (see "Declarative Skill Sources")
129
131
  ```
130
132
 
131
133
  On the other hand, if you already have AI tool configurations:
@@ -242,6 +244,18 @@ rulesync generate --dry-run --targets claudecode --features rules
242
244
  # Check if files are up to date (for CI/CD pipelines)
243
245
  rulesync generate --check --targets "*" --features "*"
244
246
 
247
+ # Install skills from declarative sources in rulesync.jsonc
248
+ rulesync install
249
+
250
+ # Force re-resolve all source refs (ignore lockfile)
251
+ rulesync install --update
252
+
253
+ # Fail if lockfile is missing or out of sync (for CI)
254
+ rulesync install --frozen
255
+
256
+ # Install then generate (typical workflow)
257
+ rulesync install && rulesync generate
258
+
245
259
  # Add generated files to .gitignore
246
260
  rulesync gitignore
247
261
 
@@ -399,6 +413,13 @@ Example:
399
413
  "simulateCommands": false, // Generate simulated commands
400
414
  "simulateSubagents": false, // Generate simulated subagents
401
415
  "simulateSkills": false, // Generate simulated skills
416
+
417
+ // Declarative skill sources — installed via 'rulesync install'
418
+ // See the "Declarative Skill Sources" section for details.
419
+ // "sources": [
420
+ // { "source": "owner/repo" },
421
+ // { "source": "org/repo", "skills": ["specific-skill"] },
422
+ // ],
402
423
  }
403
424
  ```
404
425
 
@@ -697,20 +718,26 @@ You can use global mode via Rulesync by enabling `--global` option. It can also
697
718
  Currently, supports rules and commands generation for Claude Code. Import for global files is supported for rules and commands.
698
719
 
699
720
  1. Create an any name directory. For example, if you prefer `~/.aiglobal`, run the following command.
721
+
700
722
  ```bash
701
723
  mkdir -p ~/.aiglobal
702
724
  ```
725
+
703
726
  2. Initialize files for global files in the directory.
727
+
704
728
  ```bash
705
729
  cd ~/.aiglobal
706
730
  rulesync init
707
731
  ```
732
+
708
733
  3. Edit `~/.aiglobal/rulesync.jsonc` to enable global mode.
734
+
709
735
  ```jsonc
710
736
  {
711
737
  "global": true,
712
738
  }
713
739
  ```
740
+
714
741
  4. Edit `~/.aiglobal/.rulesync/rules/overview.md` to your preferences.
715
742
 
716
743
  ```md
@@ -724,6 +751,7 @@ Currently, supports rules and commands generation for Claude Code. Import for gl
724
751
  ```
725
752
 
726
753
  5. Generate rules for global settings.
754
+
727
755
  ```bash
728
756
  # Run in the `~/.aiglobal` directory
729
757
  rulesync generate
@@ -742,6 +770,7 @@ Simulated commands, subagents and skills allow you to generate simulated feature
742
770
 
743
771
  1. Prepare `.rulesync/commands/*.md`, `.rulesync/subagents/*.md` and `.rulesync/skills/*/SKILL.md` for your purposes.
744
772
  2. Generate simulated commands, subagents and skills for specific tools that are included in cursor, codexcli and etc.
773
+
745
774
  ```bash
746
775
  rulesync generate \
747
776
  --targets copilot,cursor,codexcli \
@@ -750,6 +779,7 @@ Simulated commands, subagents and skills allow you to generate simulated feature
750
779
  --simulate-subagents \
751
780
  --simulate-skills
752
781
  ```
782
+
753
783
  3. Use simulated commands, subagents and skills in your prompts.
754
784
  - Prompt examples:
755
785
 
@@ -766,14 +796,137 @@ Simulated commands, subagents and skills allow you to generate simulated feature
766
796
 
767
797
  ## Official Skills
768
798
 
769
- Rulesync provides official skills that you can install using the fetch command:
799
+ Rulesync provides official skills that you can install using the fetch command or declarative sources:
770
800
 
771
801
  ```bash
802
+ # One-time fetch
772
803
  rulesync fetch dyoshikawa/rulesync --features skills
804
+
805
+ # Or declare in rulesync.jsonc and run 'rulesync install'
773
806
  ```
774
807
 
775
808
  This will install the Rulesync documentation skill to your project.
776
809
 
810
+ ## Declarative Skill Sources
811
+
812
+ Rulesync can fetch skills from external GitHub repositories using the `install` command. Instead of manually running `fetch` for each skill source, declare them in your `rulesync.jsonc` and run `rulesync install` to resolve and fetch them. Then `rulesync generate` picks them up as local curated skills. Typical workflow: `rulesync install && rulesync generate`.
813
+
814
+ ### Configuration
815
+
816
+ Add a `sources` array to your `rulesync.jsonc`:
817
+
818
+ ```jsonc
819
+ {
820
+ "$schema": "https://raw.githubusercontent.com/dyoshikawa/rulesync/refs/heads/main/config-schema.json",
821
+ "targets": ["copilot", "claudecode"],
822
+ "features": ["rules", "skills"],
823
+ "sources": [
824
+ // Fetch all skills from a repository
825
+ { "source": "owner/repo" },
826
+
827
+ // Fetch only specific skills by name
828
+ { "source": "anthropics/skills", "skills": ["skill-creator"] },
829
+
830
+ // With ref pinning and subdirectory path (same syntax as fetch command)
831
+ { "source": "owner/repo@v1.0.0:path/to/skills" },
832
+ ],
833
+ }
834
+ ```
835
+
836
+ Each entry in `sources` accepts:
837
+
838
+ | Property | Type | Description |
839
+ | -------- | ---------- | ----------------------------------------------------------------------------------------------------------- |
840
+ | `source` | `string` | Repository source using the same format as the `fetch` command (`owner/repo`, `owner/repo@ref:path`, etc.). |
841
+ | `skills` | `string[]` | Optional list of skill names to fetch. If omitted, all skills are fetched. |
842
+
843
+ ### How It Works
844
+
845
+ When `rulesync install` runs and `sources` is configured:
846
+
847
+ 1. **Lockfile resolution** — Each source's ref is resolved to a commit SHA and stored in `rulesync.lock` (at the project root). On subsequent runs the locked SHA is reused for deterministic builds.
848
+ 2. **Remote skill listing** — The `skills/` directory (or the path specified in the source URL) is listed from the remote repository.
849
+ 3. **Filtering** — If `skills` is specified, only matching skill directories are fetched.
850
+ 4. **Precedence rules**:
851
+ - **Local skills always win** — Skills in `.rulesync/skills/` (not in `.curated/`) take precedence; a remote skill with the same name is skipped.
852
+ - **First-declared source wins** — If two sources provide a skill with the same name, the one declared first in the `sources` array is used.
853
+ 5. **Output** — Fetched skills are written to `.rulesync/skills/.curated/<skill-name>/`. This directory is automatically added to `.gitignore` by `rulesync gitignore`.
854
+
855
+ ### CLI Options
856
+
857
+ The `install` command accepts these flags:
858
+
859
+ | Flag | Description |
860
+ | ----------------- | ------------------------------------------------------------------------------------- |
861
+ | `--update` | Force re-resolve all source refs, ignoring the lockfile (useful to pull new updates). |
862
+ | `--frozen` | Fail if lockfile is missing or out of sync. Useful for CI to ensure reproducibility. |
863
+ | `--token <token>` | GitHub token for private repositories. |
864
+
865
+ ```bash
866
+ # Install skills using locked refs
867
+ rulesync install
868
+
869
+ # Force update to latest refs
870
+ rulesync install --update
871
+
872
+ # Strict CI mode — fail if lockfile doesn't cover all sources
873
+ rulesync install --frozen
874
+
875
+ # Install then generate
876
+ rulesync install && rulesync generate
877
+
878
+ # Skip source installation — just don't run install
879
+ rulesync generate
880
+ ```
881
+
882
+ ### Lockfile
883
+
884
+ The lockfile at `rulesync.lock` (at the project root) records the resolved commit SHA and per-skill integrity hashes for each source so that builds are reproducible. It is safe to commit this file. An example:
885
+
886
+ ```json
887
+ {
888
+ "lockfileVersion": 1,
889
+ "sources": {
890
+ "owner/skill-repo": {
891
+ "requestedRef": "main",
892
+ "resolvedRef": "abc123def456...",
893
+ "resolvedAt": "2025-01-15T12:00:00.000Z",
894
+ "skills": {
895
+ "my-skill": { "integrity": "sha256-abcdef..." },
896
+ "another-skill": { "integrity": "sha256-123456..." }
897
+ }
898
+ }
899
+ }
900
+ }
901
+ ```
902
+
903
+ To update locked refs, run `rulesync install --update`.
904
+
905
+ ### Authentication
906
+
907
+ Source fetching uses the `GITHUB_TOKEN` or `GH_TOKEN` environment variable for authentication. This is required for private repositories and recommended for better rate limits.
908
+
909
+ ```bash
910
+ # Using environment variable
911
+ export GITHUB_TOKEN=ghp_xxxx
912
+ npx rulesync install
913
+
914
+ # Or using GitHub CLI
915
+ GITHUB_TOKEN=$(gh auth token) npx rulesync install
916
+ ```
917
+
918
+ > [!TIP]
919
+ > The `install` command also accepts a `--token` flag for explicit authentication: `rulesync install --token ghp_xxxx`.
920
+
921
+ ### Curated vs Local Skills
922
+
923
+ | Location | Type | Precedence | Committed to Git |
924
+ | ----------------------------------- | ------- | ---------- | ---------------- |
925
+ | `.rulesync/skills/<name>/` | Local | Highest | Yes |
926
+ | `.rulesync/skills/.curated/<name>/` | Curated | Lower | No (gitignored) |
927
+
928
+ When both a local and a curated skill share the same name, the local skill is used and the remote one is not fetched.
929
+
777
930
  ## Rulesync MCP Server
778
931
 
779
932
  Rulesync provides an MCP (Model Context Protocol) server that enables AI agents to manage your Rulesync files. This allows AI agents to discover, read, create, update, and delete files dynamically.
@@ -810,7 +963,7 @@ Add the Rulesync MCP server to your `.rulesync/mcp.json`:
810
963
 
811
964
  ## FAQ
812
965
 
813
- ### Q. The generated `.mcp.json` doesn't work properly in Claude Code.
966
+ ### Q. The generated `.mcp.json` doesn't work properly in Claude Code
814
967
 
815
968
  You can try adding the following to `.claude/settings.json` or `.claude/settings.local.json`:
816
969