@ghfs/cli 0.0.0 → 0.0.2

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/package.json CHANGED
@@ -1,9 +1,21 @@
1
1
  {
2
2
  "name": "@ghfs/cli",
3
3
  "type": "module",
4
- "version": "0.0.0",
5
- "packageManager": "pnpm@10.30.3",
6
- "description": "Mirror GitHub issues and PRs to local markdown files and execute batch maintainer actions.",
4
+ "version": "0.0.2",
5
+ "description": "GitHub issues/PRs as filesystem, for offline view and operations in batch. Designed for human and agents.",
6
+ "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
+ "license": "MIT",
8
+ "funding": "https://github.com/sponsors/antfu",
9
+ "homepage": "https://github.com/antfu/ghfs",
10
+ "repository": "https://github.com/antfu/ghfs",
11
+ "bugs": "https://github.com/antfu/ghfs/issues",
12
+ "keywords": [
13
+ "github",
14
+ "issues",
15
+ "pull requests",
16
+ "markdown",
17
+ "cli"
18
+ ],
7
19
  "exports": {
8
20
  ".": "./dist/index.mjs",
9
21
  "./cli": "./dist/cli.mjs",
@@ -14,33 +26,47 @@
14
26
  "ghfs": "./dist/cli.mjs"
15
27
  },
16
28
  "files": [
17
- "dist"
29
+ "dist",
30
+ "skills/ghfs"
18
31
  ],
19
- "scripts": {
20
- "build": "tsdown",
21
- "start": "tsx src/cli.ts",
22
- "typecheck": "tsc --noEmit",
23
- "test": "vitest run",
24
- "lint": "eslint",
25
- "schema": "tsx src/cli.ts schema"
26
- },
27
32
  "dependencies": {
28
33
  "@clack/prompts": "^1.1.0",
29
34
  "@octokit/plugin-retry": "^8.1.0",
30
35
  "@octokit/plugin-throttling": "^11.0.3",
36
+ "ansis": "^4.2.0",
31
37
  "cac": "^7.0.0",
38
+ "dotenv": "^17.3.1",
32
39
  "jiti": "^2.6.1",
33
40
  "octokit": "^5.0.5",
41
+ "pathe": "^2.0.3",
34
42
  "valibot": "^1.1.0",
35
43
  "yaml": "^2.8.2"
36
44
  },
37
45
  "devDependencies": {
38
46
  "@antfu/eslint-config": "^7.6.1",
39
47
  "@types/node": "^25.3.3",
48
+ "bumpp": "^10.4.1",
40
49
  "eslint": "^10.0.2",
50
+ "lint-staged": "^16.3.2",
51
+ "simple-git-hooks": "^2.13.1",
41
52
  "tsdown": "^0.20.3",
42
53
  "tsx": "^4.21.0",
43
54
  "typescript": "^5.9.3",
44
55
  "vitest": "^4.0.18"
56
+ },
57
+ "simple-git-hooks": {
58
+ "pre-commit": "pnpm i --frozen-lockfile --ignore-scripts --offline && npx lint-staged"
59
+ },
60
+ "lint-staged": {
61
+ "*": "eslint --fix"
62
+ },
63
+ "scripts": {
64
+ "build": "tsdown",
65
+ "start": "tsx src/cli.ts",
66
+ "typecheck": "tsc --noEmit",
67
+ "test": "vitest run",
68
+ "lint": "eslint",
69
+ "release": "bumpp",
70
+ "play": "cd playgrounds/ni && tsx ../../src/cli.ts"
45
71
  }
46
- }
72
+ }
@@ -0,0 +1,98 @@
1
+ ---
2
+ name: ghfs
3
+ description: Manages ghfs local mirror files in `.ghfs/`, especially translating user instructions into valid `.ghfs/execute.yml` operations, running `ghfs execute` / `ghfs sync`, and validating issue/PR batch edits. Use when tasks involve editing issues/PRs through `.ghfs` artifacts, reconciling sync state, or applying queued GitHub operations.
4
+ ---
5
+
6
+ # Ghfs
7
+
8
+ ## Overview
9
+
10
+ Use this skill to operate ghfs as a local filesystem mirror for GitHub issues and pull requests.
11
+
12
+ - `ghfs sync` mirrors remote content into `.ghfs/`.
13
+ - `ghfs execute` reads `.ghfs/execute.yml` and plans or applies mutations.
14
+ - Default execute mode is dry-run. Use `--apply` to mutate GitHub.
15
+
16
+ Key `.ghfs` files:
17
+ - `execute.yml`: queued operations (YAML array)
18
+ - `schema/execute.schema.json`: schema for `execute.yml`
19
+ - `.sync.json`: sync and execution run history (skip reading it)
20
+ - `issues.md`, `pulls.md`, `repo.json`: aggregated mirror views
21
+ - `issues/**/*.md`, `pulls/**/*.md`: per-item mirrors
22
+
23
+ ## Main Workflow
24
+
25
+ 1. Sync first when local data may be stale: run `ghfs sync`.
26
+ 2. Update `.ghfs/execute.yml` from user instructions.
27
+ 3. Validate and preview with `ghfs execute`.
28
+ 4. Apply only on explicit user intent: `ghfs execute --apply`.
29
+ 5. Report results and remaining queued operations.
30
+
31
+ Execution behavior to remember:
32
+ - Operations run in file order.
33
+ - On `--apply`, each successful operation is removed from `execute.yml`.
34
+ - Failed and not-yet-run operations stay in `execute.yml`.
35
+ - After apply, ghfs runs targeted sync for affected numbers automatically.
36
+
37
+ ## Update `.ghfs/execute.yml` Correctly
38
+
39
+ Keep root as a YAML array and include `number` + `action` for every entry.
40
+
41
+ ```yaml
42
+ # yaml-language-server: $schema=./schema/execute.schema.json
43
+ - number: 125
44
+ action: set-title
45
+ title: Improve sync summary output
46
+
47
+ - number: 125
48
+ action: add-labels
49
+ labels: [enhancement, cli]
50
+
51
+ - number: 126
52
+ action: request-reviewers
53
+ reviewers: [octocat]
54
+ ifUnchangedSince: '2026-03-05T04:10:00Z'
55
+ ```
56
+
57
+ Map user intent to action fields:
58
+
59
+ | User intent | action | Required extra fields |
60
+ | --- | --- | --- |
61
+ | Close / reopen | `close`, `reopen` | none |
62
+ | Change title | `set-title` | `title` |
63
+ | Replace body | `set-body` | `body` |
64
+ | Add comment | `add-comment` | `body` |
65
+ | Add/remove/set labels | `add-labels`, `remove-labels`, `set-labels` | `labels` (non-empty string array) |
66
+ | Add/remove/set assignees | `add-assignees`, `remove-assignees`, `set-assignees` | `assignees` (non-empty string array) |
67
+ | Set/clear milestone | `set-milestone`, `clear-milestone` | `milestone` for set |
68
+ | Lock/unlock conversation | `lock`, `unlock` | optional `reason` for lock |
69
+ | PR reviewer actions | `request-reviewers`, `remove-reviewers` | `reviewers` (non-empty string array) |
70
+ | PR draft state | `mark-ready-for-review`, `convert-to-draft` | none |
71
+
72
+ Rules:
73
+ - `number` must be a positive integer.
74
+ - `ifUnchangedSince` must be ISO datetime when present.
75
+ - `request-reviewers`, `remove-reviewers`, `mark-ready-for-review`, and `convert-to-draft` are PR-only.
76
+ - Keep operation order aligned with user intent because execution is sequential.
77
+ - Append operations unless user explicitly asks to replace or clear the queue.
78
+
79
+ Practical number resolution:
80
+ - Parse from filenames such as `.ghfs/issues/00123-foo.md` -> `number: 123`.
81
+ - Use `.ghfs/issues.md` / `.ghfs/pulls.md` when matching by title.
82
+
83
+ ## Run Sync and Execute via CLI
84
+
85
+ Preferred commands:
86
+
87
+ ```bash
88
+ ghfs sync
89
+ ghfs sync --full
90
+ ghfs sync --since 2026-03-01T00:00:00Z
91
+ ghfs execute
92
+ ghfs execute --apply
93
+ ```
94
+
95
+ Useful flags:
96
+ - `--repo owner/name` when repo cannot be auto-resolved.
97
+ - `--non-interactive` for scripted runs.
98
+ - `--continue-on-error` to keep applying later ops after a failure.