@aefree/pi-plastic 0.4.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 (61) hide show
  1. package/CHANGELOG.md +109 -0
  2. package/CONTRIBUTING.md +88 -0
  3. package/LICENSE +21 -0
  4. package/README.md +181 -0
  5. package/SECURITY.md +31 -0
  6. package/evals/tool-loading/README.md +38 -0
  7. package/evals/tool-loading/RESULTS.md +57 -0
  8. package/evals/tool-loading/baseline.json +34 -0
  9. package/evals/tool-loading/cases.json +70 -0
  10. package/evals/tool-loading/config.json +19 -0
  11. package/evals/tool-loading/mutation-guard.ts +30 -0
  12. package/evals/tool-loading/provider-capture.ts +22 -0
  13. package/evals/tool-loading/results/.gitignore +3 -0
  14. package/evals/tool-loading/run-eval.ts +372 -0
  15. package/extensions/bash-cm-diff-guard.ts +49 -0
  16. package/extensions/bash-cm-merge-guard.ts +53 -0
  17. package/extensions/plastic-branch-status.ts +285 -0
  18. package/extensions/repository-search-provider.ts +66 -0
  19. package/extensions/shared/bash-command-guards.ts +67 -0
  20. package/index.ts +777 -0
  21. package/package.json +76 -0
  22. package/skills/_shared/references/conventional-commits.md +198 -0
  23. package/skills/using-plastic/SKILL.md +50 -0
  24. package/skills/using-plastic/references/branch-management.md +78 -0
  25. package/skills/using-plastic/references/changeset-operations.md +96 -0
  26. package/skills/using-plastic/references/code-review-creation.md +30 -0
  27. package/skills/using-plastic/references/integration.md +47 -0
  28. package/skills/using-plastic/references/quick-reference.md +32 -0
  29. package/skills/using-plastic/references/resources.md +7 -0
  30. package/skills/using-plastic/references/reviewing-changes.md +71 -0
  31. package/skills/using-plastic/references/shelving.md +25 -0
  32. package/skills/using-plastic/references/troubleshooting.md +115 -0
  33. package/skills/using-plastic/references/workspaces.md +33 -0
  34. package/src/pi-tool-compat.ts +56 -0
  35. package/src/plastic-core.ts +4204 -0
  36. package/src/plastic-tool-loading.ts +234 -0
  37. package/src/plastic-workspace.ts +176 -0
  38. package/src/repository-search-provider.ts +64 -0
  39. package/tests/bash-cm-diff-guard-validation.ts +55 -0
  40. package/tests/fixtures/plastic.selector +3 -0
  41. package/tests/fixtures/status-compact.txt +1 -0
  42. package/tests/fixtures/status-normal.txt +1 -0
  43. package/tests/packed-copy-owner-conflict.test.ts +28 -0
  44. package/tests/pi-tool-harness.ts +116 -0
  45. package/tests/plastic-branch-create-live.test.ts +78 -0
  46. package/tests/plastic-branch-query.test.ts +26 -0
  47. package/tests/plastic-branch-status.test.ts +241 -0
  48. package/tests/plastic-checkin-path-resolution.ts +219 -0
  49. package/tests/plastic-constrained-sampling.test.ts +77 -0
  50. package/tests/plastic-diff-workflow.test.ts +86 -0
  51. package/tests/plastic-dynamic-tool-loading.test.ts +224 -0
  52. package/tests/plastic-extension-registration.test.ts +34 -0
  53. package/tests/plastic-live-smoke.test.ts +37 -0
  54. package/tests/plastic-mutation-execution.test.ts +61 -0
  55. package/tests/plastic-patch-command.test.ts +118 -0
  56. package/tests/plastic-process-lifecycle.test.ts +148 -0
  57. package/tests/plastic-tool-rendering.test.ts +16 -0
  58. package/tests/plastic-tool-validation.ts +153 -0
  59. package/tests/plastic-workspace.test.ts +62 -0
  60. package/tests/repository-search-provider-registration.test.ts +37 -0
  61. package/tests/repository-search-provider.test.ts +27 -0
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "@aefree/pi-plastic",
3
+ "version": "0.4.0",
4
+ "type": "module",
5
+ "engines": {
6
+ "node": ">=22.19.0"
7
+ },
8
+ "keywords": [
9
+ "pi-package",
10
+ "plastic-scm",
11
+ "unity-version-control",
12
+ "developer-tools"
13
+ ],
14
+ "files": [
15
+ "index.ts",
16
+ "extensions/",
17
+ "src/",
18
+ "references/",
19
+ "skills/",
20
+ "evals/tool-loading/",
21
+ "tests/",
22
+ "CHANGELOG.md",
23
+ "CONTRIBUTING.md",
24
+ "LICENSE",
25
+ "README.md",
26
+ "SECURITY.md"
27
+ ],
28
+ "pi": {
29
+ "extensions": [
30
+ "./index.ts",
31
+ "./extensions/plastic-branch-status.ts",
32
+ "./extensions/bash-cm-diff-guard.ts",
33
+ "./extensions/bash-cm-merge-guard.ts",
34
+ "./extensions/repository-search-provider.ts"
35
+ ],
36
+ "skills": [
37
+ "./skills"
38
+ ]
39
+ },
40
+ "scripts": {
41
+ "test": "npx --yes tsx tests/plastic-tool-validation.ts && npx --yes tsx tests/plastic-checkin-path-resolution.ts && npx --yes tsx tests/plastic-diff-workflow.test.ts && npx --yes tsx tests/plastic-process-lifecycle.test.ts && npx --yes tsx tests/plastic-patch-command.test.ts && npx --yes tsx tests/plastic-extension-registration.test.ts && npx --yes tsx tests/plastic-dynamic-tool-loading.test.ts && npx --yes tsx tests/plastic-tool-rendering.test.ts && npx --yes tsx tests/plastic-branch-query.test.ts && npx --yes tsx tests/plastic-workspace.test.ts && npx --yes tsx tests/plastic-mutation-execution.test.ts && npx --yes tsx tests/repository-search-provider.test.ts && npx --yes tsx tests/repository-search-provider-registration.test.ts && npx --yes tsx tests/packed-copy-owner-conflict.test.ts && npx --yes tsx tests/plastic-branch-status.test.ts && npx --yes tsx tests/plastic-constrained-sampling.test.ts && npx --yes tsx tests/bash-cm-diff-guard-validation.ts",
42
+ "test:live": "npx --yes tsx tests/plastic-live-smoke.test.ts",
43
+ "test:live:branch-create": "npx --yes tsx tests/plastic-branch-create-live.test.ts",
44
+ "eval:tool-loading": "npx --yes tsx evals/tool-loading/run-eval.ts"
45
+ },
46
+ "devDependencies": {
47
+ "@earendil-works/pi-coding-agent": "0.83.0",
48
+ "typebox": "^1.3.8"
49
+ },
50
+ "peerDependencies": {
51
+ "@aefree/pi-repo-search": "^0.1.0",
52
+ "@earendil-works/pi-coding-agent": "*",
53
+ "typebox": "*"
54
+ },
55
+ "description": "Pi tools and skills for Plastic SCM and Unity Version Control workflows.",
56
+ "license": "MIT",
57
+ "repository": {
58
+ "type": "git",
59
+ "url": "git+ssh://git@github.com/aefreedman/pi-plastic.git"
60
+ },
61
+ "bugs": {
62
+ "url": "https://github.com/aefreedman/pi-plastic/issues"
63
+ },
64
+ "homepage": "https://github.com/aefreedman/pi-plastic#readme",
65
+ "peerDependenciesMeta": {
66
+ "@aefree/pi-repo-search": {
67
+ "optional": true
68
+ },
69
+ "@earendil-works/pi-coding-agent": {
70
+ "optional": true
71
+ },
72
+ "typebox": {
73
+ "optional": true
74
+ }
75
+ }
76
+ }
@@ -0,0 +1,198 @@
1
+ # Conventional Commits
2
+
3
+ This reference file documents the conventional commit format used across the project.
4
+
5
+ ---
6
+
7
+ ## Format
8
+
9
+ ```
10
+ <type>(<scope>): <subject>
11
+
12
+ [optional body]
13
+
14
+ [optional footer]
15
+ ```
16
+
17
+ ---
18
+
19
+ ## Types
20
+
21
+ | Type | Description | Example |
22
+ |------|-------------|---------|
23
+ | **feat** | New feature | `feat(auth): add OAuth login` |
24
+ | **fix** | Bug fix | `fix(cart): calculate tax correctly` |
25
+ | **refactor** | Code restructuring (no behavior change) | `refactor(api): extract service layer` |
26
+ | **perf** | Performance improvement | `perf(query): optimize user lookup` |
27
+ | **test** | Adding or updating tests | `test(auth): add login edge cases` |
28
+ | **docs** | Documentation changes | `docs(readme): update installation steps` |
29
+ | **style** | Code style changes (formatting, etc.) | `style(lint): fix indentation` |
30
+ | **chore** | Build process or auxiliary tool changes | `chore(deps): update to Rails 7.1` |
31
+ | **ci** | CI/CD configuration changes | `ci(github): add test workflow` |
32
+
33
+ ---
34
+
35
+ ## Scope
36
+
37
+ The scope is optional but recommended. It specifies which part of the codebase was affected:
38
+
39
+ **Examples:**
40
+ - `feat(player): add dash mechanic`
41
+ - `fix(inventory): prevent negative quantities`
42
+ - `refactor(ui): simplify menu navigation`
43
+ - `perf(rendering): batch sprite draws`
44
+
45
+ **Guidelines:**
46
+ - Use lowercase
47
+ - Be specific but concise
48
+ - Match your module/component names
49
+ - Omit if change is global
50
+
51
+ ---
52
+
53
+ ## Subject
54
+
55
+ The subject contains a succinct description of the change:
56
+
57
+ - **Use imperative mood:** "add" not "added" or "adds"
58
+ - **Don't capitalize first letter:** "add feature" not "Add feature"
59
+ - **No period at the end:** "fix bug" not "fix bug."
60
+ - **Limit to 50 characters**
61
+
62
+ **Good examples:**
63
+ - `feat(auth): add password reset flow`
64
+ - `fix(api): handle null responses`
65
+ - `refactor(utils): extract string helpers`
66
+
67
+ **Bad examples:**
68
+ - `feat(auth): Added password reset flow` (not imperative)
69
+ - `feat(auth): Add Password Reset Flow` (capitalized)
70
+ - `feat(auth): add password reset flow.` (period at end)
71
+
72
+ ---
73
+
74
+ ## Body (Optional)
75
+
76
+ Use the body to explain **what** and **why**, not **how**:
77
+
78
+ ```
79
+ feat(player): add dash mechanic
80
+
81
+ Adds a dash ability to the player character for enhanced mobility.
82
+ Dash has 1-second cooldown and consumes 10 stamina.
83
+
84
+ Closes #42
85
+ ```
86
+
87
+ **Guidelines:**
88
+ - Wrap at 72 characters
89
+ - Separate from subject with blank line
90
+ - Focus on context and reasoning
91
+ - Link to issues if applicable
92
+
93
+ ---
94
+
95
+ ## Footer (Optional)
96
+
97
+ Use footer for metadata:
98
+
99
+ **Breaking changes:**
100
+ ```
101
+ feat(api)!: change authentication endpoint
102
+
103
+ BREAKING CHANGE: /api/login now requires email instead of username
104
+ ```
105
+
106
+ **Issue references:**
107
+ ```
108
+ fix(cart): calculate tax correctly
109
+
110
+ Fixes #123
111
+ Closes #124
112
+ Related to #125
113
+ ```
114
+
115
+ **Attribution:**
116
+ ```
117
+ feat(dashboard): add analytics widget
118
+
119
+ Co-Authored-By: <AI Assistant Name (e.g., Codex, Claude, Pi Coding Agent)>
120
+ ```
121
+
122
+ ---
123
+
124
+ ## Attribution Footer
125
+
126
+ Add a simple attribution line in the footer when needed:
127
+
128
+ ```
129
+ feat(feature): implement new capability
130
+
131
+ [Body explaining the change]
132
+
133
+ Co-Authored-By: <AI Assistant Name (e.g., Codex, Claude, Pi Coding Agent)>
134
+ ```
135
+
136
+ ---
137
+
138
+ ## Examples
139
+
140
+ ### Simple Feature
141
+ ```
142
+ feat(player): add jump mechanic
143
+ ```
144
+
145
+ ### Bug Fix with Context
146
+ ```
147
+ fix(inventory): prevent item duplication
148
+
149
+ Items were duplicating when rapidly clicking the pickup button.
150
+ Added debounce logic to prevent double-processing.
151
+
152
+ Fixes #156
153
+ ```
154
+
155
+ ### Refactor with Explanation
156
+ ```
157
+ refactor(rendering): extract camera controller
158
+
159
+ Moved camera logic from PlayerController to dedicated CameraController
160
+ for better separation of concerns and reusability.
161
+ ```
162
+
163
+ ### Performance Improvement
164
+ ```
165
+ perf(physics): optimize collision detection
166
+
167
+ Changed from O(n²) all-pairs check to spatial hashing.
168
+ Reduces frame time by ~15ms with 100+ objects.
169
+ ```
170
+
171
+ ### Attribution Example
172
+ ```
173
+ feat(multiplayer): add lobby system
174
+
175
+ Implements matchmaking lobby with room creation, joining, and ready-up.
176
+ Uses WebSocket for real-time updates.
177
+
178
+ Closes #89
179
+
180
+ Co-Authored-By: <AI Assistant Name (e.g., Codex, Claude, Pi Coding Agent)>
181
+ ```
182
+
183
+ ---
184
+
185
+ ## Usage in Skills
186
+
187
+ **Reference this file when:**
188
+ - Creating commits (Git or Plastic)
189
+ - Generating commit messages
190
+ - Validating commit format
191
+ - Writing PR/code review descriptions
192
+
193
+ **Load this file:**
194
+ ```markdown
195
+ Load conventional commit format from ../../_shared/references/conventional-commits.md
196
+ ```
197
+
198
+ Then format all commits according to this standard.
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: using-plastic
3
+ description: PlasticSCM operations for Unity workflows - branch management, checkins, workspace isolation, and code reviews.
4
+ ---
5
+ # using-plastic Skill
6
+
7
+ Purpose: PlasticSCM operations for Unity workflows.
8
+
9
+ ## Critical Rule
10
+
11
+ Never run `cm diff` in Pi. It may launch GUI windows and block the CLI agent.
12
+
13
+ Never run interactive `cm merge --merge` flows. Use `plastic_merge` (preferred) or explicitly pass `--nointeractiveresolution --mergetype=try` (safe default). Use source/destination policy flags only as explicit overrides.
14
+
15
+ Treat `plastic_merge` success as provisional until `plastic_status` confirms there are no merge-in-progress hints. Pending merge links are expected until the merge result is checked in; merge-in-progress hints are not. If files are manually resolved and validated but checkin is blocked by Plastic merge metadata, use `plastic_finalizeMerge` with an explicit source/destination policy before retrying checkin.
16
+
17
+ For the common closeout flow of merging a finished source branch into its parent branch, prefer `plastic_mergeToBranch` when available. When `target` is omitted, it resolves the source branch's Plastic parent branch instead of assuming `/dev`. It switches to the target, optionally updates, runs the safe merge, checks merge state, and checks in the merge result. Pass `target` only when the user explicitly wants a different integration branch.
18
+
19
+ `plastic_diff` is intentionally disabled. For the common workspace change, use `plastic_diffFile(path="<workspace-path>")` with no revision; it materializes the Plastic base internally and returns a bounded portable text diff. Use a revision only when needed: a changeset number/`cs:<number>`, `br:/<branch>`, `lb:<label>`, file-qualified spec, or global `revid:`/`rev:` spec. `base`, `head`, and `cs:head` are intentionally rejected rather than guessed. Use `plastic_diffRevisions` only for two explicit file-qualified revisions. Binary content is reported rather than decoded as text.
20
+
21
+ Use `plastic_status()` for “what changed?” and changed-path/status listing; do not use `cm diff` formatting for that purpose. Use `plastic_patch` for review patch generation with `clean` and `integration` filters; it is generation-only and does not apply patches. It uses `PI_PLASTIC_DIFF_EXECUTABLE` when set, otherwise portable `diff` on PATH; pass `toolPath` only for an intentional one-call override. For a large patch, pass an intentional new `output` path because Plastic will not overwrite it.
22
+
23
+ Prefer runtime `plastic_*` tools first. Keep `cm` shell commands as manual fallback.
24
+
25
+ Directly invoked mutating `plastic_*` tools run without package-owned approval tokens or UI confirmation. Inspect exact targets, use available preflight modes, and rely on the tools' command, workspace, path-containment, and non-interactive process guards. A command process is attempted once without implicit retry; after an ambiguous failure, inspect Plastic status before deciding whether to retry manually.
26
+
27
+ Create normal work branches beneath an intended parent: use `<parent-branch>/<new-branch>`, not `/<new-branch>`. The parent does not need to be the branch loaded in the workspace. Prefer `plastic_branchCreate(branch="<new-branch>", parent="<parent-branch>")`; omitting `parent` uses the current branch only as a convenience. Rare top-level branch creation requires the explicit `allowRootBranch=true` override.
28
+
29
+ ## External File Loading
30
+
31
+ CRITICAL: Use relative path references and load files only when needed for the current step.
32
+
33
+ - Do NOT preemptively load all reference files.
34
+ - Treat loaded references as mandatory instructions for the active task scope.
35
+ - Read the reference files only when relevant.
36
+ - For long files, use Read with `offset`/`limit` to load only needed sections.
37
+
38
+ ## Reference Files (Load On Demand)
39
+
40
+ Quick reference -> ../using-plastic/references/quick-reference.md
41
+ Branch management -> ../using-plastic/references/branch-management.md
42
+ Changesets -> ../using-plastic/references/changeset-operations.md
43
+ Reviewing changes -> ../using-plastic/references/reviewing-changes.md
44
+ Shelving -> ../using-plastic/references/shelving.md
45
+ Workspaces -> ../using-plastic/references/workspaces.md
46
+ Code review creation -> ../using-plastic/references/code-review-creation.md
47
+ Integration -> ../using-plastic/references/integration.md
48
+ Troubleshooting -> ../using-plastic/references/troubleshooting.md
49
+ Resources -> ../using-plastic/references/resources.md
50
+ Conventional commits -> ../_shared/references/conventional-commits.md
@@ -0,0 +1,78 @@
1
+ # Branch Management
2
+
3
+ ## Detect Current Branch
4
+
5
+ ```bash
6
+ current_branch=$(cm status | head -1 | cut -d@ -f1 | xargs)
7
+ ```
8
+
9
+ ## Detect Naming Convention
10
+
11
+ ```bash
12
+ cm find branches --format="{name}" | head -20
13
+ ```
14
+
15
+ Use the detected parent branch from the repository instead of copying a branch name from documentation.
16
+
17
+ ## Create Branch
18
+
19
+ Normal work branches must be children of an intended parent branch. Create `<parent-branch>/<new-branch>`, not `/<new-branch>`. The parent may differ from the branch loaded in the workspace; Plastic bases the new branch on the parent's latest changeset by default.
20
+
21
+ Preferred tool-first flow:
22
+
23
+ ```text
24
+ plastic_branchCreate(
25
+ branch="<new-branch>",
26
+ parent="<parent-branch>",
27
+ comment="<branch-description>",
28
+ ) # creates <parent-branch>/<new-branch>
29
+ plastic_switchBranch(branch="<parent-branch>/<new-branch>") # only when work should continue there
30
+ ```
31
+
32
+ Omitting `parent` for a relative branch name uses the current workspace branch as a convenience. A full hierarchical path is also accepted regardless of the loaded branch. Rare top-level branch creation requires `allowRootBranch=true`; use that override only when the user explicitly intends a new top-level hierarchy.
33
+
34
+ Manual shell fallback requires constructing the hierarchical path explicitly:
35
+
36
+ ```bash
37
+ cm branch create "<parent-branch>/<new-branch>" -c="<branch-description>"
38
+ cm switch --silent --noinput "<parent-branch>/<new-branch>"
39
+ ```
40
+
41
+ Agent preference: use runtime `plastic_*` methods first; keep shell commands as manual fallback
42
+
43
+ Pending-change behavior in unattended runs:
44
+
45
+ - `pendingChanges="bring"` is only blocked when tracked pending changes exist (Plastic requires interactive prompts).
46
+ - If pending changes are private-only, `plastic_switchBranch` performs a direct non-interactive switch and keeps private files local.
47
+ - `pendingChanges="shelve"` shelves tracked changes; for private-only pending changes, shelve is skipped and switch proceeds.
48
+
49
+ ## Merge Branches (Non-Interactive)
50
+
51
+ Preferred tool-first flow:
52
+
53
+ ```text
54
+ plastic_merge(source="<source-branch-spec>")
55
+ ```
56
+
57
+ Manual shell fallback:
58
+
59
+ ```bash
60
+ cm merge <source-branch-spec> --merge --nointeractiveresolution --mergetype=try
61
+ ```
62
+
63
+ Optional explicit override (higher clobber risk, use only when required):
64
+
65
+ ```text
66
+ plastic_merge(source="<source-branch-spec>", strategy="destination")
67
+ plastic_merge(source="<source-branch-spec>", strategy="source")
68
+ ```
69
+
70
+ ## Naming Guidelines
71
+
72
+ - Prefer a leaf name plus an explicit `parent` with `plastic_branchCreate`.
73
+ - The parent branch may differ from the branch currently loaded in the workspace.
74
+ - For full paths and manual `cm` commands, start with `/` and include the intended parent branch.
75
+ - Never shorten `<parent-branch>/<new-branch>` to `/<new-branch>`; that creates a top-level branch.
76
+ - Use lowercase and hyphens
77
+ - Follow repository conventions
78
+ - Check for issue-tracker conventions in branch names like issue ID prefixes
@@ -0,0 +1,96 @@
1
+ # Changeset Operations
2
+
3
+ ## Status
4
+
5
+ ```bash
6
+ cm status --all
7
+ ```
8
+
9
+ Tool-first:
10
+
11
+ ```text
12
+ plastic_status()
13
+ ```
14
+
15
+ ## Add Files
16
+
17
+ ```bash
18
+ cm add <workspace-path>
19
+ ```
20
+
21
+ ## Checkin
22
+
23
+ ```bash
24
+ cm checkin -c="feat(player): add dash mechanic"
25
+ ```
26
+
27
+ Tool-first:
28
+
29
+ ```text
30
+ plastic_checkin(message="feat(player): add dash mechanic", includeAll=true)
31
+ ```
32
+
33
+ Unattended behavior notes:
34
+
35
+ - `includeAll=true` includes changed/moved/deleted tracked items, but does not include private items by itself.
36
+ - `plastic_checkin` now inspects machine-readable pending changes before running checkin.
37
+ - If Plastic reports `There are no changes in the workspace` and only private items are pending in scope,
38
+ the tool auto-runs `cm add` for safe in-scope private paths, then retries checkin once.
39
+ - Sensitive private paths (for example `.env*`, private key extensions, `.npmrc`, credentials/secrets JSON)
40
+ are excluded from auto-add and reported as warnings/errors for explicit handling.
41
+ - The JSON response includes decision metadata (`decisionPath`, pre/post pending summaries, and auto-add info)
42
+ so agents can continue unattended without asking for confirmation.
43
+
44
+ Note: avoid `updateAfter=true` in unattended runs because it can trigger interactive update-merge. Use `plastic_update()` followed by `plastic_merge(...)` (default auto strategy) when a merge is required.
45
+
46
+ ## Checkins With Deletions
47
+
48
+ Before checkin, verify deleted items are present in pending changes:
49
+
50
+ ```bash
51
+ cm status --all
52
+ ```
53
+
54
+ Safe checklist:
55
+ - Confirm deleted items appear in status output before checkin.
56
+ - Prefer `plastic_checkin(preflight=true, paths=[...])` so the tool can rewrite unstable file scopes (moved/deleted) to stable parent scopes.
57
+ - `plastic_checkin` now inspects `cm status --machinereadable` and auto-enables `--applychanged` when moved/deleted items are in scope.
58
+ - Re-run `cm status --all` after add/scope changes, then checkin.
59
+
60
+ Example path-scoped checkin including a deletion:
61
+
62
+ ```bash
63
+ cm checkin -c="<commit-message>" <workspace-path-1> <workspace-path-2>
64
+ ```
65
+
66
+ Use full-scope checkin when in doubt:
67
+
68
+ ```bash
69
+ cm checkin -c="<commit-message>"
70
+ ```
71
+
72
+ ## Safe Diff Usage
73
+
74
+ Never run `cm diff` in Pi.
75
+
76
+ Use one of these safe alternatives:
77
+
78
+ ```text
79
+ plastic_status(machineReadable=true) # list pending paths/statuses
80
+ plastic_diffFile(path="<workspace-path>") # common workspace-base diff
81
+ plastic_diffFile(path="<workspace-path>", revision="cs:<number>")
82
+ plastic_diffRevisions(leftRevision="<left-file-qualified-revspec>", rightRevision="<right-file-qualified-revspec>")
83
+ ```
84
+
85
+ The typed diff tools own historical `cm cat --file` materialization and cleanup; do not create agent-authored temporary files for ordinary diffs.
86
+
87
+ ## Commit Message Format
88
+
89
+ Use conventional commits from ../../_shared/references/conventional-commits.md.
90
+
91
+ ## Changeset History
92
+
93
+ ```bash
94
+ cm find changeset --orderby="date desc" --limit=20 \
95
+ --format="{changesetid} {date} {owner} {comment}"
96
+ ```
@@ -0,0 +1,30 @@
1
+ # Code Review Creation
2
+
3
+ ## CLI (Preferred)
4
+
5
+ ```bash
6
+ branch=$(cm status | head -1 | cut -d@ -f1 | xargs)
7
+ review_id=$(cm codereview "br:${branch}" "Feature: Brief description" --format="{id}")
8
+
9
+ # Assign reviewer immediately after creating the review
10
+ cm codereview -e "$review_id" --reviewer="reviewer-name"
11
+
12
+ # List reviews for this branch
13
+ cm find review "where target='br:${branch}'" --format="{id} {status} {title}"
14
+ ```
15
+
16
+ Agent preference: use runtime `plastic_*` methods first for status/branch lookup; keep shell commands as manual fallback.
17
+
18
+ Reviewer assignment is required in the workflow. If your server uses different reviewer flags, run `cm codereview --help` and use the server-specific reviewer option right after review creation.
19
+
20
+ Tool-first flow (preferred):
21
+
22
+ ```text
23
+ plastic_status()
24
+ # Then use cm codereview ... as fallback for review create/assign
25
+ ```
26
+
27
+ ## CLI Not Available
28
+
29
+ - Document branch and changeset in plan/issue tracker.
30
+ - Or create review via Plastic GUI and assign a reviewer before sharing the review link.
@@ -0,0 +1,47 @@
1
+ # Integration Points
2
+
3
+ ## Work Workflow
4
+
5
+ - Create feature branch following detected conventions.
6
+ - Use incremental checkins.
7
+ - Never use `cm diff`; use text-only diff tools.
8
+ - Use `plastic_merge` (or `cm merge ... --nointeractiveresolution --mergetype=try`) for autonomous merges.
9
+
10
+ ## Autonomous Merge Workflow
11
+
12
+ - Switch to the target branch/workspace and ensure you understand the current pending state.
13
+ - Run `plastic_merge(...)`.
14
+ - If Plastic stops on a delete/change directory conflict and source deletion is the intended resolution, run `plastic_resolveDeleteChangeConflict(...)`, then rerun `plastic_merge(...)`.
15
+ - Immediately run `plastic_status()` and treat it as the source of truth.
16
+ - Do not treat merge-tool success alone as proof that the merge is finished.
17
+ - If `plastic_status()` still shows `Pending merge links`, merge-in-progress state, or conflict-like pending items, stop and follow troubleshooting before any checkin.
18
+ - After compile/tests, run `plastic_status()` again so Unity-generated private artifacts are not mistaken for merge fallout.
19
+ - Only then create the merge checkin.
20
+
21
+ ## Review Workflow
22
+
23
+ - Create or reuse review workspace.
24
+ - Switch to target branch and list recent changesets:
25
+
26
+ ```bash
27
+ cm find changeset "where branch = '<branch-name>' order by changesetid desc limit 20" --format="{changesetid} {owner} {date} {comment}" --nototal
28
+ ```
29
+
30
+ - Generate a focused branch-review patch when a whole-branch view is useful:
31
+
32
+ ```text
33
+ plastic_patch(source="<branch-spec>", integration=true)
34
+ plastic_patch(source="<branch-spec>", clean=true, integration=true, output="<patch-file>")
35
+ ```
36
+
37
+ - Inspect specific file content changes with the common workspace-base path first:
38
+
39
+ ```text
40
+ plastic_diffFile(path="<workspace-path>")
41
+ plastic_diffFile(path="<workspace-path>", revision="cs:<number>")
42
+ plastic_diffRevisions(leftRevision="<left-file-qualified-revspec>", rightRevision="<right-file-qualified-revspec>")
43
+ ```
44
+
45
+ ## Plan Workflow
46
+
47
+ - Search changeset history for related work.
@@ -0,0 +1,32 @@
1
+ # Plastic Quick Reference
2
+
3
+ Use runtime `plastic_*` tools first. Keep shell commands below as manual fallback.
4
+
5
+ Note: command examples target current `cm` 11.x CLI syntax; legacy aliases may differ.
6
+
7
+ | Operation | Preferred tool method | Shell fallback | Notes |
8
+ |-----------|------------------------|----------------|-------|
9
+ | Status | `plastic_status()` | `cm status` | Pending changes |
10
+ | Current branch | `plastic_currentBranch()` | `cm status | head -1 | cut -d@ -f1 | xargs` | Reads active branch |
11
+ | Create child branch | `plastic_branchCreate(branch="<new-branch>", parent="<parent-branch>")` | `cm branch create <parent-branch>/<new-branch>` | Parent may differ from the loaded branch; top-level creation requires explicit override |
12
+ | Switch branch | `plastic_switchBranch(branch="<branch-spec>")` | `cm switch --silent --noinput <branch-spec>` | `pendingChanges="shelve"` for tracked pending changes; private-only pending changes switch directly unattended |
13
+ | Add files | `plastic_add(paths=[...])` | `cm add <files>` | Stage for checkin |
14
+ | Checkin | `plastic_checkin(message="...")` | `cm checkin -c="message"` | Commit changes (`includeAll` excludes private unless added/`includePrivate`) |
15
+ | Update | `plastic_update()` | `cm update --dontmerge --noinput` | Pull latest without interactive merge |
16
+ | Merge | `plastic_merge(source="<source-branch-spec>")` | `cm merge <source-branch-spec> --merge --nointeractiveresolution --mergetype=try` | Surfaces `FILE_CONFLICT`; run `plastic_status()` before checkin |
17
+ | Finalize merge metadata | `plastic_finalizeMerge(source="<source-branch-spec>", strategy="destination")` | `cm merge <source-branch-spec> --merge --nointeractiveresolution --mergetype=forced --keepdestination` | Use after manual/reviewed resolution when checkin says merge is still in progress |
18
+ | Shelve | `plastic_shelvesetCreate(comment="description")` | `cm shelveset create -c="description"` | Save work temporarily |
19
+ | Patch for review | `plastic_patch(source="<branch-spec>", clean=true, integration=true, output="<patch-file>")` | `cm patch <branch-spec> --clean --integration --output=<patch-file>` | Focused branch-review patch; inspect before sharing |
20
+ | Changed-file listing | `plastic_status(machineReadable=true)` | `cm status --all` | Lists changed, added, moved, deleted, and private items without GUI diff |
21
+ | Diff (workspace vs Plastic base) | `plastic_diffFile(path="<workspace-path>")` | None recommended | Bounded portable text diff; no guessed revision needed |
22
+ | Diff (workspace vs supported revision) | `plastic_diffFile(path="<workspace-path>", revision="cs:<number>")` | None recommended | Also accepts a branch, label, file-qualified, or global revision spec |
23
+ | Diff (revision vs revision) | `plastic_diffRevisions(leftRevision="<left-revspec>", rightRevision="<right-revspec>")` | None recommended | Requires two file-qualified revisions; avoids GUI and package temp-file recipes |
24
+
25
+ ## Merge verification checklist
26
+
27
+ - Run `plastic_merge(...)`.
28
+ - If `plastic_merge(...)` reports `FILE_CONFLICT`, inspect/resolve the listed paths and validate before finalizing.
29
+ - Immediately run `plastic_status()`.
30
+ - Pending merge links are expected until the merge result is checked in; merge-in-progress hints are blockers.
31
+ - If validation/tests were run after the merge, run `plastic_status()` again before checkin so generated private artifacts do not muddy the result.
32
+ - If `plastic_checkin(...)` says a merge is still in progress after files are resolved and validated, run `plastic_finalizeMerge(source=..., strategy="destination")`, then retry checkin.
@@ -0,0 +1,7 @@
1
+ # Resources
2
+
3
+ - CLI Reference: https://docs.unity.com/en-us/unity-version-control/uvcs-cli
4
+ - Branch Management: https://docs.unity.com/en-us/unity-version-control/branches
5
+ - Code Reviews: https://docs.unity.com/en-us/unity-version-control/code-reviews
6
+
7
+ Minimum version: PlasticSCM 11.0+