@agimon-ai/po-git 0.0.0-alpha.2 → 0.0.0-alpha.200

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 (37) hide show
  1. package/LICENSE +97 -8
  2. package/README.md +91 -21
  3. package/dist/apiContracts.cjs +82 -16
  4. package/dist/apiContracts.cjs.map +1 -1
  5. package/dist/apiContracts.d.mts +2 -2
  6. package/dist/apiContracts.d.mts.map +1 -1
  7. package/dist/apiContracts.mjs +82 -16
  8. package/dist/apiContracts.mjs.map +1 -1
  9. package/dist/extensions/native.mjs +2255 -544
  10. package/dist/extensions/native.mjs.map +1 -1
  11. package/dist/extensions/server.cjs +1562 -514
  12. package/dist/extensions/server.cjs.map +1 -1
  13. package/dist/extensions/server.d.mts +2 -2
  14. package/dist/extensions/server.d.mts.map +1 -1
  15. package/dist/extensions/server.mjs +1525 -477
  16. package/dist/extensions/server.mjs.map +1 -1
  17. package/dist/extensions/web.mjs +1761 -1388
  18. package/dist/extensions/web.mjs.map +1 -1
  19. package/dist/gitDependencies-D8bKxZSc.cjs +2690 -0
  20. package/dist/gitDependencies-D8bKxZSc.cjs.map +1 -0
  21. package/dist/gitDependencies-Delu4xip.mjs +2432 -0
  22. package/dist/gitDependencies-Delu4xip.mjs.map +1 -0
  23. package/dist/index.cjs +13 -22
  24. package/dist/index.d.mts +266 -14
  25. package/dist/index.d.mts.map +1 -1
  26. package/dist/index.mjs +3 -22
  27. package/dist/po-runtime-identity.json +1 -0
  28. package/llms.txt +3 -3
  29. package/package.json +104 -26
  30. package/src/prompts/codemode-how-to-git/SKILL.md +137 -0
  31. package/dist/index.cjs.map +0 -1
  32. package/dist/index.mjs.map +0 -1
  33. package/dist/worktreeOperations-CaqwGsD_.mjs +0 -1065
  34. package/dist/worktreeOperations-CaqwGsD_.mjs.map +0 -1
  35. package/dist/worktreeOperations-MgIVDDu3.cjs +0 -1221
  36. package/dist/worktreeOperations-MgIVDDu3.cjs.map +0 -1
  37. package/src/prompts/po-use-git/SKILL.md +0 -87
@@ -0,0 +1,137 @@
1
+ ---
2
+ name: codemode-how-to-git
3
+ description: 'Hand a branch of work to a separate session in its own checkout, keeping the current checkout untouched. Use for a long refactor, a risky migration, or parallel features that touch the same files; not for parallel work on one branch.'
4
+ ---
5
+
6
+ # Worktree sessions
7
+
8
+ In code mode the `worktrees` namespace creates a git worktree and starts a Po
9
+ session inside it: call `discover({ namespace: 'worktrees' })` for the types,
10
+ then `exec`. Without code mode use `run_worktree` for checkout management.
11
+ The new session appears nested under the current one in the SESSIONS rail, so a
12
+ parent can hand off a branch of work and keep its own checkout untouched.
13
+
14
+ New worktrees live outside the repository, under `git/worktrees` in the admitted
15
+ Po home (normally `~/.po`). Use the path on the record: an imported checkout
16
+ stays in its original directory.
17
+
18
+ ## When to use it
19
+
20
+ Use a worktree when work needs its own branch **and** its own checkout at the
21
+ same time: a long refactor you want to leave half-finished, a risky migration,
22
+ or two features that touch the same files.
23
+
24
+ Do not reach for it to parallelise work that shares a branch. Two sessions on
25
+ one branch in two checkouts will fight, and git refuses the second worktree.
26
+
27
+ A new checkout has no installed dependencies unless `.po/worktree.yaml` defines
28
+ `setup`. If it does, check the child session's `worktree-setup` runner before
29
+ building. A retained checkout after a setup failure is not a reason to spawn again.
30
+
31
+ ## Sparse checkouts
32
+
33
+ Use `worktrees.profiles()` to discover the repository's checkout profiles. Pass
34
+ `sparseProfile` to `spawn` to select files, not `profile` or `selection.profile`.
35
+ For example, use `{ branch: 'wt/fix-web', sparseProfile: 'web' }` if `web` is
36
+ listed. `full` means the whole repository. Omit `sparseProfile` to use the
37
+ workspace default, or ordinary Git or Rift when no default is configured.
38
+ An existing branch uses its own commit; a new branch uses its selected base.
39
+
40
+ When more files are needed, use `worktrees.expand(id, ['apps/mobile'])` instead
41
+ of creating another checkout. Folders must be repository-relative and cannot
42
+ overlap an exclusion. Use `worktrees.reapply(id)` to read the updated profile
43
+ at HEAD without dropping earlier expansions. For repositories not initialized
44
+ for per-worktree config, stop and ask the owner to run the explicit `sparo init`
45
+ step in the package README. Do not change shared Git config on their behalf.
46
+
47
+ ## Isolated workflow runs
48
+
49
+ Use `worktrees.startWorkflow` instead of `spawn` followed by a separate workflow
50
+ launch when a repository workflow needs its own checkout. List workflows from
51
+ the repository root with `workflow.list()`. Use the definition's repository-relative
52
+ path as `key`, including any folders. Do not use an absolute path or a stored
53
+ library workflow. The workspace needs Workflow and a remote-tracking base. The
54
+ new checkout branches from that base, but the run uses your session's own copy of
55
+ the definition, so an uncommitted or unpushed workflow still runs; files it reads
56
+ at runtime come from the new checkout. `branch` must be a new branch name. The
57
+ launcher does not run the regular checkout `setup`; preparation belongs to the
58
+ workflow. Pass string `inputs`, not environment, target sessions or allocations.
59
+
60
+ ```ts
61
+ const launch = await worktrees.startWorkflow({
62
+ key: 'automations/check.workflow.yml', // use the path for your repository
63
+ attemptId: 'check-change-42',
64
+ inputs: { component: 'web' },
65
+ });
66
+ ```
67
+
68
+ Optional `branch` and `sparseProfile` select the checkout. Save the `attemptId`
69
+ and reuse it with **the same arguments** when checking the same launch. A
70
+ `pending` admission is not a lost run. `registered` includes a `runId`, not
71
+ proof that the workflow finished. If an outcome is unknown, inspect the child
72
+ and the saved attempt; do not change the ID to try again. Successful work may
73
+ be closed non-forcibly after its checkout and delivery are verified. The branch
74
+ stays. Failed, dirty or unverified work is kept for inspection.
75
+
76
+ ## Actions
77
+
78
+ ```ts
79
+ await worktrees.spawn({ branch: 'wt/fix-auth' });
80
+ await worktrees.list();
81
+ await worktrees.status('a1b2c3d4');
82
+ await worktrees.merge('a1b2c3d4');
83
+ await worktrees.close('a1b2c3d4');
84
+ await worktrees.prune({ dryRun: true });
85
+ await worktrees.send('a1b2c3d4', 'Please report progress');
86
+ await worktrees.messages('a1b2c3d4');
87
+ ```
88
+
89
+ Records come back as objects, so filter them in the script rather than reading
90
+ printed text. `spawn` can be slow: pass a larger `timeoutMs` to `exec`. It takes
91
+ `branch`, and optionally `baseRef` (otherwise the upstream or remote default),
92
+ `name` for the rail, and `task` as the session's first message. Operations on
93
+ one worktree take its short `id`, never its path or branch. Each listed record
94
+ carries a `relationship` relative to the calling session: `parent` means you
95
+ created the worktree, `child` means you are its worktree session, and `other`
96
+ means neither. To report to your parent from a nested worktree, use your own
97
+ record with relationship `child`, not the record for your parent's worktree. Use
98
+ `parent` records to contact your own children. These labels do not grant
99
+ permission to send, merge, or close another session's worktree.
100
+
101
+ `send` delivers between a worktree session and its parent. A `spawn`
102
+ `task` is the first message to the new session. Both use durable Session delivery
103
+ when available. A delivery error after the worktree is created does not remove
104
+ the worktree. Do not spawn it again to retry the task.
105
+
106
+ If admission requires recovery, call `messages` from the **recipient** session
107
+ with the worktree id to retrieve the persisted text. Do not resend automatically.
108
+ If admission merely timed out, delivery may still be pending: check the delivery
109
+ id in the sender's outbox or call `messages` from the recipient before deciding
110
+ whether to resend. A timeout does not prove the message was lost. If persistence
111
+ itself failed, inspect the worktree and sender outbox before using `send` again.
112
+
113
+ ## What it refuses, and why
114
+
115
+ - **`close` on a dirty tree.** It names the uncommitted files and stops.
116
+ Pass `{ force: true }` only after reading that list. The files are gone after.
117
+ - **`merge` when the parent checkout is dirty.** The merge lands in the parent,
118
+ so uncommitted edits there would be folded into a merge commit nobody meant to
119
+ make. Commit or stash first.
120
+ - **`spawn` on a branch that already has a worktree.** Close the
121
+ existing one or pick another branch.
122
+ - **`prune` never deletes a worktree holding uncommitted work**, and never
123
+ touches a directory this tool did not create. It reports those instead.
124
+
125
+ Run `prune` with `{ dryRun: true }` first. The plan tells you exactly what would be
126
+ removed, forgotten, and left alone.
127
+
128
+ ## Notes
129
+
130
+ - A worktree session is a peer, not a subagent. It has its own context and its
131
+ own turn loop. When it goes idle it reports to its parent once with
132
+ `network.send({ to: parent, text, terminal: true })`; `worktrees.send` stays
133
+ for progress updates.
134
+ - Closing the parent does not close its worktree sessions. They keep running and
135
+ stay in the rail.
136
+ - `spawn` needs the cockpit running, because the cockpit owns session
137
+ lifecycle. Without it the call rejects with a message rather than half-creating anything.
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","names":["createWorktreeOperations","createWorktreeGit"],"sources":["../src/services/extensionService/index.ts","../src/services/gitDependencies/index.ts"],"sourcesContent":["// @scaffold-generated\nimport type { GitExtensionResult, GitExtensionService } from '../../types/extension';\n\nexport class DefaultGitExtensionService implements GitExtensionService {\n async execute(): Promise<GitExtensionResult> {\n return { message: 'Show git worktrees owned by this session', level: 'info' };\n }\n}\n","import type { GitExtensionDependencies } from '../../types/extension';\nimport { DefaultGitExtensionService } from '../extensionService';\n// @scaffold-generated\nimport { createWorktreeGit } from '../gitCli';\nimport { createWorktreeOperations } from '../worktreeOperations';\n\nexport function createGitDependencies(overrides: Partial<GitExtensionDependencies> = {}): GitExtensionDependencies {\n return {\n service: overrides.service ?? new DefaultGitExtensionService(),\n operations: overrides.operations ?? createWorktreeOperations({ git: createWorktreeGit() }),\n };\n}\n"],"mappings":";;;AAGA,IAAa,6BAAb,MAAuE;CACrE,MAAM,UAAuC;EAC3C,OAAO;GAAE,SAAS;GAA4C,OAAO;EAAO;CAC9E;AACF;;;ACDA,SAAgB,sBAAsB,YAA+C,CAAC,GAA6B;CACjH,OAAO;EACL,SAAS,UAAU,WAAW,IAAI,2BAA2B;EAC7D,YAAY,UAAU,cAAcA,2BAAAA,yBAAyB,EAAE,KAAKC,2BAAAA,kBAAkB,EAAE,CAAC;CAC3F;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/services/extensionService/index.ts","../src/services/gitDependencies/index.ts"],"sourcesContent":["// @scaffold-generated\nimport type { GitExtensionResult, GitExtensionService } from '../../types/extension';\n\nexport class DefaultGitExtensionService implements GitExtensionService {\n async execute(): Promise<GitExtensionResult> {\n return { message: 'Show git worktrees owned by this session', level: 'info' };\n }\n}\n","import type { GitExtensionDependencies } from '../../types/extension';\nimport { DefaultGitExtensionService } from '../extensionService';\n// @scaffold-generated\nimport { createWorktreeGit } from '../gitCli';\nimport { createWorktreeOperations } from '../worktreeOperations';\n\nexport function createGitDependencies(overrides: Partial<GitExtensionDependencies> = {}): GitExtensionDependencies {\n return {\n service: overrides.service ?? new DefaultGitExtensionService(),\n operations: overrides.operations ?? createWorktreeOperations({ git: createWorktreeGit() }),\n };\n}\n"],"mappings":";;AAGA,IAAa,6BAAb,MAAuE;CACrE,MAAM,UAAuC;EAC3C,OAAO;GAAE,SAAS;GAA4C,OAAO;EAAO;CAC9E;AACF;;;ACDA,SAAgB,sBAAsB,YAA+C,CAAC,GAA6B;CACjH,OAAO;EACL,SAAS,UAAU,WAAW,IAAI,2BAA2B;EAC7D,YAAY,UAAU,cAAc,yBAAyB,EAAE,KAAK,kBAAkB,EAAE,CAAC;CAC3F;AACF"}