ctxr-cli 0.35.0 → 0.37.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 (150) hide show
  1. package/LICENSE +21 -201
  2. package/README.md +39 -11
  3. package/dist/commands/land.d.ts +1 -1
  4. package/dist/commands/land.d.ts.map +1 -1
  5. package/dist/commands/land.js +8 -4
  6. package/dist/commands/land.js.map +1 -1
  7. package/dist/commands/plugin-build.d.ts +21 -11
  8. package/dist/commands/plugin-build.d.ts.map +1 -1
  9. package/dist/commands/plugin-build.js +45 -24
  10. package/dist/commands/plugin-build.js.map +1 -1
  11. package/dist/commands/serve.d.ts +3 -0
  12. package/dist/commands/serve.d.ts.map +1 -1
  13. package/dist/commands/serve.js +121 -23
  14. package/dist/commands/serve.js.map +1 -1
  15. package/dist/commands/session-submit.d.ts.map +1 -1
  16. package/dist/commands/session-submit.js +2 -0
  17. package/dist/commands/session-submit.js.map +1 -1
  18. package/dist/commands/sync.d.ts +50 -0
  19. package/dist/commands/sync.d.ts.map +1 -0
  20. package/dist/commands/sync.js +186 -0
  21. package/dist/commands/sync.js.map +1 -0
  22. package/dist/commands/version.d.ts.map +1 -1
  23. package/dist/commands/version.js +6 -3
  24. package/dist/commands/version.js.map +1 -1
  25. package/dist/config/defaults.d.ts +13 -0
  26. package/dist/config/defaults.d.ts.map +1 -1
  27. package/dist/config/defaults.js +11 -0
  28. package/dist/config/defaults.js.map +1 -1
  29. package/dist/config/schema.d.ts +1 -0
  30. package/dist/config/schema.d.ts.map +1 -1
  31. package/dist/config/schema.js +7 -0
  32. package/dist/config/schema.js.map +1 -1
  33. package/dist/core/approval/sessions.d.ts.map +1 -1
  34. package/dist/core/approval/sessions.js +4 -2
  35. package/dist/core/approval/sessions.js.map +1 -1
  36. package/dist/core/browse/approve.d.ts.map +1 -1
  37. package/dist/core/browse/approve.js +12 -2
  38. package/dist/core/browse/approve.js.map +1 -1
  39. package/dist/core/browse/page-url.d.ts +13 -0
  40. package/dist/core/browse/page-url.d.ts.map +1 -1
  41. package/dist/core/browse/page-url.js +17 -0
  42. package/dist/core/browse/page-url.js.map +1 -1
  43. package/dist/core/browse/pull-preview.d.ts +67 -0
  44. package/dist/core/browse/pull-preview.d.ts.map +1 -0
  45. package/dist/core/browse/pull-preview.js +154 -0
  46. package/dist/core/browse/pull-preview.js.map +1 -0
  47. package/dist/core/browse/webhook.d.ts +38 -0
  48. package/dist/core/browse/webhook.d.ts.map +1 -0
  49. package/dist/core/browse/webhook.js +102 -0
  50. package/dist/core/browse/webhook.js.map +1 -0
  51. package/dist/core/command.d.ts +5 -3
  52. package/dist/core/command.d.ts.map +1 -1
  53. package/dist/core/errors.d.ts +16 -0
  54. package/dist/core/errors.d.ts.map +1 -1
  55. package/dist/core/errors.js +27 -0
  56. package/dist/core/errors.js.map +1 -1
  57. package/dist/core/git/exec.d.ts +16 -1
  58. package/dist/core/git/exec.d.ts.map +1 -1
  59. package/dist/core/git/exec.js +15 -4
  60. package/dist/core/git/exec.js.map +1 -1
  61. package/dist/core/git/fast-forward.d.ts +23 -0
  62. package/dist/core/git/fast-forward.d.ts.map +1 -1
  63. package/dist/core/git/fast-forward.js +24 -0
  64. package/dist/core/git/fast-forward.js.map +1 -1
  65. package/dist/core/git/hardened.d.ts +15 -0
  66. package/dist/core/git/hardened.d.ts.map +1 -0
  67. package/dist/core/git/hardened.js +123 -0
  68. package/dist/core/git/hardened.js.map +1 -0
  69. package/dist/core/install-kind.d.ts +10 -3
  70. package/dist/core/install-kind.d.ts.map +1 -1
  71. package/dist/core/install-kind.js +48 -14
  72. package/dist/core/install-kind.js.map +1 -1
  73. package/dist/core/mcp/surface.js +1 -1
  74. package/dist/core/mcp/surface.js.map +1 -1
  75. package/dist/core/mcp/sync.d.ts +4 -1
  76. package/dist/core/mcp/sync.d.ts.map +1 -1
  77. package/dist/core/mcp/sync.js +6 -5
  78. package/dist/core/mcp/sync.js.map +1 -1
  79. package/dist/core/mcp/tool-map.d.ts +13 -11
  80. package/dist/core/mcp/tool-map.d.ts.map +1 -1
  81. package/dist/core/mcp/tool-map.js +13 -11
  82. package/dist/core/mcp/tool-map.js.map +1 -1
  83. package/dist/core/mcp/tools/gather.d.ts.map +1 -1
  84. package/dist/core/mcp/tools/gather.js +5 -4
  85. package/dist/core/mcp/tools/gather.js.map +1 -1
  86. package/dist/core/mcp/tools/index.d.ts +9 -1
  87. package/dist/core/mcp/tools/index.d.ts.map +1 -1
  88. package/dist/core/mcp/tools/index.js +20 -3
  89. package/dist/core/mcp/tools/index.js.map +1 -1
  90. package/dist/core/npm-prefix.d.ts +10 -0
  91. package/dist/core/npm-prefix.d.ts.map +1 -0
  92. package/dist/core/npm-prefix.js +11 -0
  93. package/dist/core/npm-prefix.js.map +1 -0
  94. package/dist/core/plugin/build.d.ts +53 -26
  95. package/dist/core/plugin/build.d.ts.map +1 -1
  96. package/dist/core/plugin/build.js +153 -50
  97. package/dist/core/plugin/build.js.map +1 -1
  98. package/dist/core/plugin/commands.d.ts +11 -0
  99. package/dist/core/plugin/commands.d.ts.map +1 -0
  100. package/dist/core/plugin/commands.js +23 -0
  101. package/dist/core/plugin/commands.js.map +1 -0
  102. package/dist/core/plugin/routes.d.ts +11 -7
  103. package/dist/core/plugin/routes.d.ts.map +1 -1
  104. package/dist/core/plugin/routes.js +27 -24
  105. package/dist/core/plugin/routes.js.map +1 -1
  106. package/dist/core/session/submit.d.ts +7 -0
  107. package/dist/core/session/submit.d.ts.map +1 -1
  108. package/dist/core/session/submit.js +14 -3
  109. package/dist/core/session/submit.js.map +1 -1
  110. package/dist/core/shared-stores.d.ts +5 -0
  111. package/dist/core/shared-stores.d.ts.map +1 -1
  112. package/dist/core/shared-stores.js +10 -0
  113. package/dist/core/shared-stores.js.map +1 -1
  114. package/dist/core/skill-placeholders.d.ts +51 -0
  115. package/dist/core/skill-placeholders.d.ts.map +1 -0
  116. package/dist/core/skill-placeholders.js +55 -0
  117. package/dist/core/skill-placeholders.js.map +1 -0
  118. package/dist/core/skills.d.ts +37 -12
  119. package/dist/core/skills.d.ts.map +1 -1
  120. package/dist/core/skills.js +78 -89
  121. package/dist/core/skills.js.map +1 -1
  122. package/dist/core/store-update-runner.d.ts +57 -0
  123. package/dist/core/store-update-runner.d.ts.map +1 -0
  124. package/dist/core/{approval/lander.js → store-update-runner.js} +41 -17
  125. package/dist/core/store-update-runner.js.map +1 -0
  126. package/dist/run.d.ts.map +1 -1
  127. package/dist/run.js +37 -6
  128. package/dist/run.js.map +1 -1
  129. package/dist/version.d.ts +1 -1
  130. package/dist/version.js +1 -1
  131. package/package.json +3 -2
  132. package/templates/approve/pages-note-pull.md +1 -0
  133. package/templates/conventions/baseline-conventions.md +5 -0
  134. package/templates/mcp/server-instructions.md +16 -0
  135. package/templates/plugin/README.md +30 -8
  136. package/templates/plugin/chatgpt-README.md +16 -0
  137. package/templates/plugin/claude-plugin.json +9 -1
  138. package/templates/plugin/command.md +7 -0
  139. package/templates/plugin/page.html +19 -8
  140. package/templates/skills/_surfaces.md +30 -0
  141. package/templates/skills/ctxr-placement.md +1 -1
  142. package/templates/skills/ctxr-session-lifecycle.md +6 -5
  143. package/templates/skills/ctxr-upgrade.md +5 -5
  144. package/templates/skills/mcp/_layer-step.md +18 -0
  145. package/templates/skills/mcp/_relation-grouping-step.md +5 -0
  146. package/dist/core/approval/lander.d.ts +0 -38
  147. package/dist/core/approval/lander.d.ts.map +0 -1
  148. package/dist/core/approval/lander.js.map +0 -1
  149. package/templates/plugin/claude-mcp.json +0 -8
  150. package/templates/skills/mcp/_preamble.md +0 -44
@@ -1,38 +0,0 @@
1
- /**
2
- * change-approval spec ("The server lands what was approved";
3
- * serve-lands-approved-changes D2, D3): `ctxr serve` lands approved changes by
4
- * running `ctxr land --pending` — the same command a person runs — as a child
5
- * process, so a resolver that runs for minutes, a hang or a crash stays out of
6
- * the request loop. The one place serve spawns it.
7
- *
8
- * Three states: idle, running, running with one more run pending. Any number of
9
- * triggers during a run produce exactly one further run. A sweep triggers every
10
- * `sweepMs`, and once shortly after start, so approvals recorded while the
11
- * server was down land promptly.
12
- */
13
- export interface Lander {
14
- trigger(): void;
15
- stop(): Promise<void>;
16
- }
17
- export interface ChildLike {
18
- stdout: NodeJS.ReadableStream | null;
19
- stderr: NodeJS.ReadableStream | null;
20
- once(event: 'close', listener: (code: number | null) => void): unknown;
21
- kill(signal?: NodeJS.Signals): boolean;
22
- }
23
- export type SpawnLike = (command: string, args: string[], opts: {
24
- cwd: string;
25
- env: NodeJS.ProcessEnv;
26
- }) => ChildLike;
27
- export interface LanderOptions {
28
- /** The executable and its leading arguments, e.g. [node, bin.js]. */
29
- command: readonly string[];
30
- root: string;
31
- env: Readonly<Record<string, string | undefined>>;
32
- output: NodeJS.WritableStream;
33
- sweepMs?: number;
34
- firstSweepMs?: number;
35
- spawn?: SpawnLike;
36
- }
37
- export declare function createLander(opts: LanderOptions): Lander;
38
- //# sourceMappingURL=lander.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lander.d.ts","sourceRoot":"","sources":["../../../src/core/approval/lander.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,MAAM;IACrB,OAAO,IAAI,IAAI,CAAC;IAChB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IACrC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,GAAG,OAAO,CAAC;IACvE,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;CACxC;AAED,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAA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AM,CAAC;gBACvB,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBACtB,MAAM,OAAO,CAAC;YAChB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,8 +0,0 @@
1
- {
2
- "mcpServers": {
3
- "__NAME__": {
4
- "type": "http",
5
- "url": "__MCP_URL__"
6
- }
7
- }
8
- }
@@ -1,44 +0,0 @@
1
- ## Before this skill: the store's tools stand in for a checkout
2
-
3
- You are working through this store's server, not in a checkout of it. Nothing runs a shell here, so no
4
- `git`, `gh` or `ctxr` command runs as written. The skill below was written for an agent with a checkout:
5
- follow it as written, and take each step it names through the tool these tables give.
6
-
7
- ### Commands
8
-
9
- __COMMAND_TABLE__
10
-
11
- A command marked none has no counterpart here: skip that step and say nothing about it. Each other tool takes its command's options as fields, each named for its option without the leading
12
- dashes, and the session the command names as `session`: the session worktree's directory name, which
13
- `session_start` returns and `session_list` lists. `session_start` takes the session's name as `label`.
14
-
15
- Every other `ctxr` step runs through the `ctxr` tool when the command only reads, and through `ctxr_write`
16
- when it writes. Pass the words after `ctxr` as `args`, one word per entry: a step that says to run
17
- `ctxr lint` is the `ctxr` tool with `args` set to `["lint"]`. Name a session as `session` to run the command
18
- in that session's working tree; `ctxr_write` always needs one. When a command reads a file you prepared,
19
- pass the file's text as `input` and write `@input` in `args` where its path goes.
20
-
21
- ### Git steps
22
-
23
- __GIT_STEP_TABLE__
24
-
25
- Commits, pushes and pull requests happen only in `session_submit`. A step marked none is the server's own
26
- work: it keeps the store's clone current, and `session_start` branches from the freshly fetched default
27
- branch. Skip that step and say nothing about it.
28
-
29
- ### Paths
30
-
31
- `session_start` returns the session's root, a path such as `__WORKTREES_PATH__<directory>/`. Every path the
32
- skill names is relative to the store; inside a session it goes under that root, so the note `work/a.md` in
33
- that session is `__WORKTREES_PATH__<directory>/work/a.md` for `Read`, `Edit`, `Write`, `Move`, `Delete`,
34
- `Grep` and `Glob`. A path without a session root reads the store as it was last approved, and a write to one
35
- is refused. A change rests uncommitted in its session until `session_submit`.
36
-
37
- ### Sessions across conversations
38
-
39
- The server keeps a session between conversations, but it cannot tell two conversations apart. At the
40
- start of a conversation, call `session_list` and mention each open session: what it holds uncommitted,
41
- and any requested changes on its pull request. Work in the session the person names, or start one.
42
-
43
- Where the skill hands off to a skill this environment does not carry, such as landing or upgrading, or
44
- asks you to work inside a store mounted under `shared/`, that step is not yours here: a person lands an approved change from the store's approval page.