ghostrail 0.0.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 (218) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +16 -0
  3. package/README.md +56 -0
  4. package/dist/agent/claude-code.d.ts +37 -0
  5. package/dist/agent/claude-code.d.ts.map +1 -0
  6. package/dist/agent/claude-code.js +74 -0
  7. package/dist/agent/claude-code.js.map +1 -0
  8. package/dist/agent/index.d.ts +4 -0
  9. package/dist/agent/index.d.ts.map +1 -0
  10. package/dist/agent/index.js +4 -0
  11. package/dist/agent/index.js.map +1 -0
  12. package/dist/agent/prompt.d.ts +9 -0
  13. package/dist/agent/prompt.d.ts.map +1 -0
  14. package/dist/agent/prompt.js +15 -0
  15. package/dist/agent/prompt.js.map +1 -0
  16. package/dist/agent/result.d.ts +16 -0
  17. package/dist/agent/result.d.ts.map +1 -0
  18. package/dist/agent/result.js +56 -0
  19. package/dist/agent/result.js.map +1 -0
  20. package/dist/args.d.ts +27 -0
  21. package/dist/args.d.ts.map +1 -0
  22. package/dist/args.js +25 -0
  23. package/dist/args.js.map +1 -0
  24. package/dist/backend/container.d.ts +18 -0
  25. package/dist/backend/container.d.ts.map +1 -0
  26. package/dist/backend/container.js +70 -0
  27. package/dist/backend/container.js.map +1 -0
  28. package/dist/backend/docker.d.ts +22 -0
  29. package/dist/backend/docker.d.ts.map +1 -0
  30. package/dist/backend/docker.js +38 -0
  31. package/dist/backend/docker.js.map +1 -0
  32. package/dist/backend/fs.d.ts +9 -0
  33. package/dist/backend/fs.d.ts.map +1 -0
  34. package/dist/backend/fs.js +21 -0
  35. package/dist/backend/fs.js.map +1 -0
  36. package/dist/backend/index.d.ts +7 -0
  37. package/dist/backend/index.d.ts.map +1 -0
  38. package/dist/backend/index.js +6 -0
  39. package/dist/backend/index.js.map +1 -0
  40. package/dist/backend/local-worktree.d.ts +17 -0
  41. package/dist/backend/local-worktree.d.ts.map +1 -0
  42. package/dist/backend/local-worktree.js +51 -0
  43. package/dist/backend/local-worktree.js.map +1 -0
  44. package/dist/backend/proc.d.ts +24 -0
  45. package/dist/backend/proc.d.ts.map +1 -0
  46. package/dist/backend/proc.js +103 -0
  47. package/dist/backend/proc.js.map +1 -0
  48. package/dist/backend/types.d.ts +75 -0
  49. package/dist/backend/types.d.ts.map +1 -0
  50. package/dist/backend/types.js +12 -0
  51. package/dist/backend/types.js.map +1 -0
  52. package/dist/bin.d.ts +3 -0
  53. package/dist/bin.d.ts.map +1 -0
  54. package/dist/bin.js +10 -0
  55. package/dist/bin.js.map +1 -0
  56. package/dist/board/index.d.ts +4 -0
  57. package/dist/board/index.d.ts.map +1 -0
  58. package/dist/board/index.js +4 -0
  59. package/dist/board/index.js.map +1 -0
  60. package/dist/board/page.d.ts +3 -0
  61. package/dist/board/page.d.ts.map +1 -0
  62. package/dist/board/page.js +55 -0
  63. package/dist/board/page.js.map +1 -0
  64. package/dist/board/server.d.ts +36 -0
  65. package/dist/board/server.d.ts.map +1 -0
  66. package/dist/board/server.js +110 -0
  67. package/dist/board/server.js.map +1 -0
  68. package/dist/board/stats.d.ts +26 -0
  69. package/dist/board/stats.d.ts.map +1 -0
  70. package/dist/board/stats.js +57 -0
  71. package/dist/board/stats.js.map +1 -0
  72. package/dist/cli/commands.d.ts +39 -0
  73. package/dist/cli/commands.d.ts.map +1 -0
  74. package/dist/cli/commands.js +224 -0
  75. package/dist/cli/commands.js.map +1 -0
  76. package/dist/cli.d.ts +16 -0
  77. package/dist/cli.d.ts.map +1 -0
  78. package/dist/cli.js +45 -0
  79. package/dist/cli.js.map +1 -0
  80. package/dist/commands/help.d.ts +6 -0
  81. package/dist/commands/help.d.ts.map +1 -0
  82. package/dist/commands/help.js +29 -0
  83. package/dist/commands/help.js.map +1 -0
  84. package/dist/config/duration.d.ts +14 -0
  85. package/dist/config/duration.d.ts.map +1 -0
  86. package/dist/config/duration.js +25 -0
  87. package/dist/config/duration.js.map +1 -0
  88. package/dist/config/index.d.ts +5 -0
  89. package/dist/config/index.d.ts.map +1 -0
  90. package/dist/config/index.js +4 -0
  91. package/dist/config/index.js.map +1 -0
  92. package/dist/config/load.d.ts +26 -0
  93. package/dist/config/load.d.ts.map +1 -0
  94. package/dist/config/load.js +306 -0
  95. package/dist/config/load.js.map +1 -0
  96. package/dist/config/result.d.ts +18 -0
  97. package/dist/config/result.d.ts.map +1 -0
  98. package/dist/config/result.js +7 -0
  99. package/dist/config/result.js.map +1 -0
  100. package/dist/config/schema.d.ts +77 -0
  101. package/dist/config/schema.d.ts.map +1 -0
  102. package/dist/config/schema.js +35 -0
  103. package/dist/config/schema.js.map +1 -0
  104. package/dist/factory/build.d.ts +39 -0
  105. package/dist/factory/build.d.ts.map +1 -0
  106. package/dist/factory/build.js +85 -0
  107. package/dist/factory/build.js.map +1 -0
  108. package/dist/gate/gate.d.ts +12 -0
  109. package/dist/gate/gate.d.ts.map +1 -0
  110. package/dist/gate/gate.js +22 -0
  111. package/dist/gate/gate.js.map +1 -0
  112. package/dist/gate/index.d.ts +2 -0
  113. package/dist/gate/index.d.ts.map +1 -0
  114. package/dist/gate/index.js +2 -0
  115. package/dist/gate/index.js.map +1 -0
  116. package/dist/global/index.d.ts +3 -0
  117. package/dist/global/index.d.ts.map +1 -0
  118. package/dist/global/index.js +3 -0
  119. package/dist/global/index.js.map +1 -0
  120. package/dist/global/stage.d.ts +13 -0
  121. package/dist/global/stage.d.ts.map +1 -0
  122. package/dist/global/stage.js +24 -0
  123. package/dist/global/stage.js.map +1 -0
  124. package/dist/global/store.d.ts +30 -0
  125. package/dist/global/store.d.ts.map +1 -0
  126. package/dist/global/store.js +65 -0
  127. package/dist/global/store.js.map +1 -0
  128. package/dist/lock/file-lock.d.ts +16 -0
  129. package/dist/lock/file-lock.d.ts.map +1 -0
  130. package/dist/lock/file-lock.js +51 -0
  131. package/dist/lock/file-lock.js.map +1 -0
  132. package/dist/loop/branch.d.ts +14 -0
  133. package/dist/loop/branch.d.ts.map +1 -0
  134. package/dist/loop/branch.js +24 -0
  135. package/dist/loop/branch.js.map +1 -0
  136. package/dist/loop/engine.d.ts +37 -0
  137. package/dist/loop/engine.d.ts.map +1 -0
  138. package/dist/loop/engine.js +204 -0
  139. package/dist/loop/engine.js.map +1 -0
  140. package/dist/loop/index.d.ts +6 -0
  141. package/dist/loop/index.d.ts.map +1 -0
  142. package/dist/loop/index.js +3 -0
  143. package/dist/loop/index.js.map +1 -0
  144. package/dist/loop/ports.d.ts +97 -0
  145. package/dist/loop/ports.d.ts.map +1 -0
  146. package/dist/loop/ports.js +2 -0
  147. package/dist/loop/ports.js.map +1 -0
  148. package/dist/loop/record.d.ts +26 -0
  149. package/dist/loop/record.d.ts.map +1 -0
  150. package/dist/loop/record.js +2 -0
  151. package/dist/loop/record.js.map +1 -0
  152. package/dist/publish/gh.d.ts +24 -0
  153. package/dist/publish/gh.d.ts.map +1 -0
  154. package/dist/publish/gh.js +109 -0
  155. package/dist/publish/gh.js.map +1 -0
  156. package/dist/publish/githost.d.ts +54 -0
  157. package/dist/publish/githost.d.ts.map +1 -0
  158. package/dist/publish/githost.js +33 -0
  159. package/dist/publish/githost.js.map +1 -0
  160. package/dist/publish/github-publisher.d.ts +30 -0
  161. package/dist/publish/github-publisher.d.ts.map +1 -0
  162. package/dist/publish/github-publisher.js +51 -0
  163. package/dist/publish/github-publisher.js.map +1 -0
  164. package/dist/publish/index.d.ts +4 -0
  165. package/dist/publish/index.d.ts.map +1 -0
  166. package/dist/publish/index.js +4 -0
  167. package/dist/publish/index.js.map +1 -0
  168. package/dist/respond/index.d.ts +4 -0
  169. package/dist/respond/index.d.ts.map +1 -0
  170. package/dist/respond/index.js +4 -0
  171. package/dist/respond/index.js.map +1 -0
  172. package/dist/respond/respond.d.ts +42 -0
  173. package/dist/respond/respond.d.ts.map +1 -0
  174. package/dist/respond/respond.js +128 -0
  175. package/dist/respond/respond.js.map +1 -0
  176. package/dist/respond/select.d.ts +22 -0
  177. package/dist/respond/select.d.ts.map +1 -0
  178. package/dist/respond/select.js +31 -0
  179. package/dist/respond/select.js.map +1 -0
  180. package/dist/respond/store.d.ts +25 -0
  181. package/dist/respond/store.d.ts.map +1 -0
  182. package/dist/respond/store.js +49 -0
  183. package/dist/respond/store.js.map +1 -0
  184. package/dist/secrets/redact.d.ts +11 -0
  185. package/dist/secrets/redact.d.ts.map +1 -0
  186. package/dist/secrets/redact.js +21 -0
  187. package/dist/secrets/redact.js.map +1 -0
  188. package/dist/source/index.d.ts +2 -0
  189. package/dist/source/index.d.ts.map +1 -0
  190. package/dist/source/index.js +2 -0
  191. package/dist/source/index.js.map +1 -0
  192. package/dist/source/linear.d.ts +61 -0
  193. package/dist/source/linear.d.ts.map +1 -0
  194. package/dist/source/linear.js +166 -0
  195. package/dist/source/linear.js.map +1 -0
  196. package/dist/store/events.d.ts +105 -0
  197. package/dist/store/events.d.ts.map +1 -0
  198. package/dist/store/events.js +64 -0
  199. package/dist/store/events.js.map +1 -0
  200. package/dist/store/file-store.d.ts +49 -0
  201. package/dist/store/file-store.d.ts.map +1 -0
  202. package/dist/store/file-store.js +188 -0
  203. package/dist/store/file-store.js.map +1 -0
  204. package/dist/store/index.d.ts +3 -0
  205. package/dist/store/index.d.ts.map +1 -0
  206. package/dist/store/index.js +3 -0
  207. package/dist/store/index.js.map +1 -0
  208. package/dist/version.d.ts +3 -0
  209. package/dist/version.d.ts.map +1 -0
  210. package/dist/version.js +21 -0
  211. package/dist/version.js.map +1 -0
  212. package/package.json +52 -0
  213. package/templates/content-loop/README.md +23 -0
  214. package/templates/content-loop/ghostrail.toml +36 -0
  215. package/templates/content-loop/prompts/draft.md +29 -0
  216. package/templates/fix-bugs-local/README.md +23 -0
  217. package/templates/fix-bugs-local/ghostrail.toml +37 -0
  218. package/templates/fix-bugs-local/prompts/fix-bug.md +27 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;GAIG;AACH,SAAS,WAAW;IAClB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3D,MAAM,GAAG,GAAG,YAAY,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;QACxD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAA0B,CAAC;QACrD,OAAO,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IACjE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC;AAED,6CAA6C;AAC7C,MAAM,CAAC,MAAM,OAAO,GAAW,WAAW,EAAE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "ghostrail",
3
+ "version": "0.0.0",
4
+ "description": "Open source software factory for coding agents. Config-driven loops, pluggable isolation backends, human merge gate.",
5
+ "keywords": [
6
+ "ai-agents",
7
+ "coding-agent",
8
+ "agent-orchestration",
9
+ "software-factory",
10
+ "claude-code",
11
+ "self-hosted"
12
+ ],
13
+ "license": "Apache-2.0",
14
+ "author": "Timothy Jordan <timothy@timothyjordan.com>",
15
+ "homepage": "https://ghostrail.dev",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/timothyjordan/ghostrail.git"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/timothyjordan/ghostrail/issues"
22
+ },
23
+ "type": "module",
24
+ "bin": {
25
+ "ghostrail": "dist/bin.js"
26
+ },
27
+ "files": ["dist", "templates", "LICENSE", "NOTICE", "README.md"],
28
+ "engines": {
29
+ "node": ">=22"
30
+ },
31
+ "packageManager": "pnpm@9.15.9",
32
+ "scripts": {
33
+ "build": "tsc -p tsconfig.build.json",
34
+ "typecheck": "tsc -p tsconfig.json",
35
+ "lint": "biome check .",
36
+ "lint:fix": "biome check --write .",
37
+ "format": "biome format --write .",
38
+ "test": "vitest run",
39
+ "test:unit": "vitest run",
40
+ "test:watch": "vitest"
41
+ },
42
+ "devDependencies": {
43
+ "@biomejs/biome": "1.9.4",
44
+ "@types/node": "^22.10.2",
45
+ "fast-check": "^4.9.0",
46
+ "typescript": "^5.7.2",
47
+ "vitest": "^2.1.8"
48
+ },
49
+ "dependencies": {
50
+ "smol-toml": "^1.7.1"
51
+ }
52
+ }
@@ -0,0 +1,23 @@
1
+ # content-loop
2
+
3
+ A content factory: the agent writes a draft file, there is no code gate, and the
4
+ PR opens as a draft for you to review. This is the `tjwrite`/`research` shape.
5
+
6
+ ## Setup
7
+ 1. `ghostrail init content-loop` in your writing repo (or copy this folder in).
8
+ 2. Edit `ghostrail.toml`: set `source.project`, the `eligible` filter, and the
9
+ `artifacts` list to the shared references you want staged into each run.
10
+ 3. Put those references in your global store as Markdown, e.g.
11
+ `~/.config/ghostrail/artifacts/voice-and-style-profile.md`. List them with
12
+ `ghostrail artifacts`.
13
+ 4. Export `LINEAR_API_KEY` and authenticate `gh`.
14
+
15
+ ## Run
16
+ ```bash
17
+ ghostrail run # draft eligible pieces and open draft PRs
18
+ ghostrail board # watch runs at http://127.0.0.1:4369/
19
+ ```
20
+
21
+ The shared artifacts are staged into each run at `.ghostrail/artifacts/` so the
22
+ same voice and formats apply across every factory instance, without copying them
23
+ into each repo.
@@ -0,0 +1,36 @@
1
+ # content-loop: the tjwrite/research shape. The agent writes a draft file, there
2
+ # is no code gate, and the PR opens as a draft. Shared writing artifacts (voice,
3
+ # formats) come from your global store.
4
+
5
+ # Shared artifacts staged into each run's workspace from the global store
6
+ # (~/.config/ghostrail/artifacts/<name>.md). See `ghostrail artifacts`.
7
+ # (A root-level key must come before any [table] header.)
8
+ artifacts = ["voice-and-style-profile", "content-strategy-playbook"]
9
+
10
+ [factory]
11
+ name = "content"
12
+ base_branch = "main"
13
+
14
+ [source]
15
+ kind = "linear"
16
+ project = "TJ" # your Linear team key
17
+ eligible = { state = "Todo", label = "draft", unassigned = true }
18
+
19
+ [agent]
20
+ kind = "claude-code"
21
+ prompt = "prompts/draft.md"
22
+
23
+ [backend]
24
+ kind = "local-worktree"
25
+
26
+ # No [gate]: a content factory has no code oracle. A human reviews the draft.
27
+
28
+ [guardrails]
29
+ max_items_per_run = 3
30
+ budget_usd_per_item = 3
31
+ timeout = "30m"
32
+
33
+ [output]
34
+ open_pr = true
35
+ draft = true # content PRs open as drafts
36
+ auto_merge = false
@@ -0,0 +1,29 @@
1
+ # Draft a piece
2
+
3
+ You are a writing agent working in an isolated checkout. Write the piece
4
+ described below as a Markdown file. You may only read and write files. Do not use
5
+ git: the factory owns commits, branches, and PRs.
6
+
7
+ ## The brief
8
+ - ID: {{id}}
9
+ - Title: {{title}}
10
+ - Link: {{url}}
11
+
12
+ ## Shared references
13
+ Read any files under `.ghostrail/artifacts/` (voice and style, formats,
14
+ strategy). Follow them closely: they define how this work should read.
15
+
16
+ ## What to do
17
+ 1. Write the draft as a new Markdown file under `drafts/`, named for the piece.
18
+ 2. Match the voice, structure, and formats in the shared references.
19
+ 3. Do not publish or post anything; produce a draft only.
20
+
21
+ ## Reporting your result (required, do this last)
22
+ Write `.ghostrail/result.json` with exactly one of:
23
+
24
+ - `{"status":"done","summary":"<one-paragraph summary of the draft>"}`
25
+ - `{"status":"blocked","questions":"<what you need decided>"}`
26
+ - `{"status":"failed","error":"<why>"}`
27
+ - `{"status":"noop"}`
28
+
29
+ The factory opens a draft pull request for a human to review.
@@ -0,0 +1,23 @@
1
+ # fix-bugs-local
2
+
3
+ A code factory that runs on your own hardware with zero infrastructure. It drains
4
+ eligible tracker issues, fixes each in an isolated git worktree, gates the result
5
+ against your CI, and opens a pull request. It never merges.
6
+
7
+ ## Setup
8
+ 1. `ghostrail init fix-bugs-local` in your repo (or copy this folder in).
9
+ 2. Edit `ghostrail.toml`: set `source.project` to your Linear team key and the
10
+ `eligible` filter, and set `gate.commands` to your CI steps.
11
+ 3. Export `LINEAR_API_KEY` (a Linear personal API key) and make sure `gh` is
12
+ authenticated for your repo.
13
+
14
+ ## Run
15
+ ```bash
16
+ ghostrail run # one tick: claim eligible issues, fix, gate, open PRs
17
+ ghostrail respond # fold new human PR comments back into their branches
18
+ ghostrail board # watch runs at http://127.0.0.1:4369/
19
+ ```
20
+
21
+ An issue is eligible when it is `Todo`, unassigned, and labeled `factory`
22
+ (configurable). The agent only ever writes files; ghostrail does all git, tracker,
23
+ and PR work, and stops at a PR you merge.
@@ -0,0 +1,37 @@
1
+ # fix-bugs-local: a code factory on your own hardware, zero infrastructure.
2
+ # Point it at a repo and a tracker label; it fixes bugs and opens PRs you merge.
3
+
4
+ [factory]
5
+ name = "fix-bugs"
6
+ base_branch = "main"
7
+
8
+ [source]
9
+ kind = "linear" # linear | github-issues (Phase 2)
10
+ project = "TJ" # your Linear team key
11
+ eligible = { state = "Todo", label = "factory", unassigned = true }
12
+
13
+ [agent]
14
+ kind = "claude-code"
15
+ prompt = "prompts/fix-bug.md"
16
+ # default allowed_tools = ["Read", "Edit", "Write", "Bash", "Grep", "Glob"]
17
+
18
+ [backend]
19
+ kind = "local-worktree" # zero infrastructure; git worktree in place
20
+
21
+ [gate] # the oracle: mirror your CI
22
+ commands = [
23
+ "pnpm install --frozen-lockfile",
24
+ "pnpm lint",
25
+ "pnpm typecheck",
26
+ "pnpm test:unit",
27
+ "pnpm build",
28
+ ]
29
+
30
+ [guardrails]
31
+ max_items_per_run = 3
32
+ budget_usd_per_item = 3
33
+ timeout = "30m"
34
+
35
+ [output]
36
+ open_pr = true
37
+ auto_merge = false # a human owns every merge
@@ -0,0 +1,27 @@
1
+ # Fix a bug
2
+
3
+ You are a coding agent working in an isolated checkout of a repository. Fix the
4
+ issue described below. You may only read and write files and run shell commands
5
+ in this workspace. Do not use git: the factory owns commits, branches, and PRs.
6
+
7
+ ## The issue
8
+ - ID: {{id}}
9
+ - Title: {{title}}
10
+ - Link: {{url}}
11
+
12
+ ## What to do
13
+ 1. Reproduce and locate the bug.
14
+ 2. Make the smallest correct fix.
15
+ 3. Add or update unit tests that cover it.
16
+ 4. Keep the change focused; do not refactor unrelated code.
17
+
18
+ ## Reporting your result (required, do this last)
19
+ Write a JSON file at `.ghostrail/result.json` with exactly one of these shapes:
20
+
21
+ - Success: `{"status":"done","summary":"<what you changed, one paragraph>"}`
22
+ - Needs a human decision: `{"status":"blocked","questions":"<the decision you need>"}`
23
+ - Could not fix it: `{"status":"failed","error":"<why>"}`
24
+ - No change needed: `{"status":"noop"}`
25
+
26
+ The factory reads this file to decide what to do, then runs your CI gate and, if
27
+ it passes, opens a pull request for a human to review and merge.