@altotyler/alto-rootstock-cli 1.0.3 → 1.0.4

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@altotyler/alto-rootstock-cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "CLI for creating and managing Rootstock Salesforce DX projects with AI agent scaffolding",
5
5
  "bin": {
6
6
  "altors": "./bin/altors.js"
@@ -0,0 +1,28 @@
1
+ # Rootstock Project — Agent Router
2
+
3
+ This repo uses Rootstock ERP (Salesforce managed package, rstk__/rstkf__ namespaces).
4
+
5
+ Before answering Rootstock questions, use the Read tool to load only the skill files you need. Do not load all files by default.
6
+
7
+ ## Skill Router
8
+
9
+ | Topic | Load this file |
10
+ |-------|---------------|
11
+ | Mission, scope, core rules, non-negotiables, best practices | `.claude/skills/rootstock-core.md` |
12
+ | SOAPI modes, sales order object chain (sohdr/soline/soship/soorddmd/sohdrpay) | `.claude/skills/rootstock-soapi.md` |
13
+ | SYDATA transaction types, inventory/cost processing, async queue | `.claude/skills/rootstock-sydata.md` |
14
+ | SYDATAT transaction IDs, inventory transfers between locations/sites/divisions | `.claude/skills/rootstock-sydatat.md` |
15
+ | POLOADER modes, purchasing object chain (pocntl/pohdr/poline/poitem) | `.claude/skills/rootstock-poloader.md` |
16
+ | Work orders, WO components, cost transactions, manufacturing flows | `.claude/skills/rootstock-manufacturing.md` |
17
+ | Item masters (peitem/icitem/soprod/poitem), inventory state (iclocitem/icitemlot/icitemsrl) | `.claude/skills/rootstock-inventory.md` |
18
+ | Test data factories, setup sequence, coverage requirements, trigger options | `.claude/skills/rootstock-testing.md` |
19
+ | Debugging strategy, org metadata inspection, proactive org queries, community research | `.claude/skills/rootstock-debug.md` |
20
+ | Session init, MCP setup, deploy/test preferences, agent updates/upgrades | `.claude/skills/rootstock-session.md` |
21
+
22
+ ## Quick Reference
23
+
24
+ - Trigger options in tests only: `rstk__triggeroptions__c = 'UT'` (rstk__) / `rstkf__triggeroptions__c = 'UT'` (rstkf__)
25
+ - **NEVER set triggeroptions in production code — it suppresses Rootstock automation in live data.**
26
+ - SYDATA ≠ SYDATAT: SYDATA processes inventory/cost transactions; SYDATAT moves inventory between locations/sites/divisions.
27
+ - Item setup chain: peitem → icitem → soprod (sales) / poitem (purchasing)
28
+ - Always check org controls before assuming package behavior.
@@ -0,0 +1,93 @@
1
+ # Rootstock Core — Mission, Scope, and Rules
2
+
3
+ ## Mission
4
+
5
+ Help implement, debug, and test Salesforce logic that depends on Rootstock and related managed packages, with emphasis on:
6
+
7
+ - Rootstock namespace patterns: rstk__, rstkf__, and Rootstock package behavior.
8
+ - Rootstock DOX package patterns (dox__/Rootstock DOX dependencies) when present.
9
+ - Stable test-data setup for Rootstock-dependent automation and triggers.
10
+ - Safe diagnosis of Rootstock trigger side effects and required setup data.
11
+ - Broad ERP flow coverage across Rootstock domains (manufacturing, purchasing, inventory, sales, and cost controls).
12
+
13
+ Do not provide guidance that depends on this repo's custom-object business model. Keep recommendations package-centric and reusable.
14
+
15
+ ## Scope Boundaries
16
+
17
+ In scope:
18
+ - Rootstock managed-package objects/fields and their setup dependencies.
19
+ - Rootstock test data factory patterns and extension points.
20
+ - Rootstock sales order lifecycle objects.
21
+ - Manufacturing lifecycle objects.
22
+ - Purchasing lifecycle objects.
23
+ - Inventory and item-master lifecycle objects.
24
+ - Configuration/control objects that drive ERP behavior by company/division.
25
+ - Rootstock trigger behavior, required defaults, and validation constraints.
26
+
27
+ Out of scope:
28
+ - Custom-object process design, org-specific business rules, and custom workflow semantics.
29
+ - Advice that hard-codes custom-object orchestration unless explicitly requested.
30
+
31
+ Important scope behavior:
32
+ - If a user request is outside Rootstock package behavior, do not force Rootstock context onto the solution.
33
+ - If a request mixes Rootstock and non-Rootstock concerns, apply Rootstock rules only to the Rootstock-dependent parts.
34
+
35
+ ## Core Operating Rules
36
+
37
+ - Prefer evidence from local code and tests over assumptions.
38
+ - Keep changes minimal, deterministic, and namespace-safe.
39
+ - Preserve existing public interfaces unless a change is explicitly requested.
40
+ - When Rootstock behavior is uncertain, validate with focused probes instead of broad rewrites.
41
+ - When test data creation is heavy, use @testSetup and batchable setup patterns already used in this codebase.
42
+ - Always advise against SeeAllData=true for Rootstock test development.
43
+ - For Rootstock package work, prefer one of the two Rootstock data factories over ad hoc record creation.
44
+ - For any Rootstock record creation in tests, set the trigger option by namespace:
45
+ - For rstk__ objects: rstk__triggeroptions__c = 'UT'
46
+ - For rstkf__ objects: rstkf__triggeroptions__c = 'UT'
47
+ - Do not set both fields on every object by default.
48
+ - **CRITICAL: triggeroptions = 'UT' is for Apex test methods ONLY. Never set this field in production code, triggers, flows, or any non-test context. Setting UT outside of tests suppresses Rootstock package automation in live data.**
49
+
50
+ ## System and Control Objects
51
+
52
+ These are the baseline configuration/control records that underpin all ERP flows:
53
+
54
+ - rstk__sydefault__c (System Defaults)
55
+ - rstk__syconfig__c (System Configuration)
56
+ - rstk__socntl__c (Sales Order Control by division)
57
+ - rstk__pocntl__c (PO Control by division)
58
+ - rstkf__apcntl__c (AP Control by financial company)
59
+ - rstk__arcntl__c (AR Control by financial company)
60
+ - rstk__syordnumassign__c (Order Number Assignments)
61
+ - rstk__csacctcntl__c (Cost Accounting Control)
62
+ - rstk__syusr__c (Manufacturing Users)
63
+
64
+ ## Non-Negotiables
65
+
66
+ - Do not inject custom-object-specific business assumptions unless explicitly requested.
67
+ - Do not remove existing Rootstock setup scaffolding without proving it is unnecessary.
68
+ - Do not broaden scope to unrelated architecture changes when a setup fix solves the issue.
69
+
70
+ ## Response Style Requirements
71
+
72
+ - Be explicit about which Rootstock object dependency is missing or misconfigured.
73
+ - Provide concrete insertion/update order when suggesting data creation.
74
+ - Distinguish package constraints from custom-code constraints.
75
+ - When uncertain, say what must be verified and propose the smallest probe to verify it.
76
+ - Keep response depth balanced by complexity (brief for simple asks, fuller snippets for complex fixes).
77
+
78
+ ## Preferred Deliverables
79
+
80
+ When asked for implementation help, provide one or more of:
81
+
82
+ - A minimal data-factory patch for missing Rootstock setup records.
83
+ - A focused test setup snippet that seeds only required Rootstock records.
84
+ - A small guard/validation patch that prevents duplicate or invalid Rootstock record creation.
85
+ - A short verification checklist for SOAPI/SOHDR/SOLINE/SOSHIP/SOORDDMD/SOHDRPAY flows.
86
+ - A short verification checklist for WO/WO Component/WO Cost, PO Header/PO Line, and inventory state flows.
87
+
88
+ ## Best Practices
89
+
90
+ - When building new LWCs or Apex classes that interact with Rootstock objects, prefer @wire/getRecord to avoid Apex calls. This minimises complexities with Rootstock test classes and test data.
91
+ - When writing test classes for Rootstock objects, use existing test data factory methods in this repo or the preferred private factory. This ensures test data is consistent with required Rootstock package behavior and reduces unexpected trigger side effects.
92
+ - When troubleshooting Rootstock flows, always check for required setup records and trigger options before making assumptions about code behavior.
93
+ - Ask questions when building something Rootstock-related to get full context: required fields, object dependencies, or other information that ensures a robust solution that works with Rootstock's managed package behavior first time.
@@ -0,0 +1,65 @@
1
+ # Rootstock Debugging — Strategy, Org Inspection, and Community Research
2
+
3
+ ## Debugging Strategy
4
+
5
+ When diagnosing Rootstock issues, execute in this order:
6
+
7
+ 1. Confirm required baseline setup records exist (syconfig, company, division, site, UOM, controls).
8
+ 2. Confirm triggeroptions mode and execution user context.
9
+ 3. Isolate failure to the earliest transactional object in the chain (sohdr, then soline, then dependent records).
10
+ 4. Inspect managed-package validation/trigger side effects before changing business logic.
11
+ 5. Add or adjust setup data first; only then alter production logic.
12
+ 6. If unresolved or ambiguous, ask the user how they want to proceed rather than guessing org-specific behavior.
13
+
14
+ ## Org Metadata and Control Inspection
15
+
16
+ Use org metadata and live control data before making assumptions.
17
+
18
+ 1. Query active control/settings records via Salesforce DX MCP SOQL.
19
+ 2. Query object definitions via EntityDefinition where needed.
20
+ 3. If FieldDefinition/EntityParticle metadata queries are not supported in the org API path, use CLI describe fallback:
21
+ ```
22
+ sf sobject describe --sobject <objectApiName> --target-org <org>
23
+ ```
24
+ 4. Prioritize field help text and labels from describe output when explaining what a setting does.
25
+ 5. Keep test/setup recommendations aligned to observed org controls, not generic defaults.
26
+
27
+ Reference artifact in this repo: docs/rootstock-field-help-sample.md
28
+
29
+ ## Proactive Org Querying
30
+
31
+ When answering questions about SYDATAT, SYDATA, SOAPI, or POLOADER, proactively query the org for relevant existing records before answering. Use Salesforce DX MCP SOQL first. If MCP is unavailable, fall back to CLI:
32
+ ```
33
+ sf data query --query "<SOQL>" --target-org <org>
34
+ ```
35
+
36
+ Useful context queries:
37
+ - SYDATAT: `SELECT Id, rstk__sydatat_txnid__c, rstk__sydatat_process__c, rstk__sydatat_message__c FROM rstk__sydatat__c ORDER BY CreatedDate DESC LIMIT 5`
38
+ - SYDATA: `SELECT Id, rstk__sydata_txntype__c, rstk__sydata_process__c, rstk__sydata_message__c FROM rstk__sydata__c ORDER BY CreatedDate DESC LIMIT 5`
39
+ - ICLocItem: `SELECT Id, Name, rstk__iclocitem_item__c, rstk__iclocitem_loc__c, rstk__iclocitem_qtyonhand__c FROM rstk__iclocitem__c LIMIT 10`
40
+ - SOAPI: `SELECT Id, rstk__soapi_mode__c, rstk__soapi_process__c, rstk__soapi_message__c FROM rstk__soapi__c ORDER BY CreatedDate DESC LIMIT 5`
41
+ - POLOADER: `SELECT Id, rstk__poloader_mode__c, rstk__poloader_process__c, rstk__poloader_message__c FROM rstk__poloader__c ORDER BY CreatedDate DESC LIMIT 5`
42
+
43
+ Summarize what you found (or that no records exist) so the user understands their org's current state. Do not skip org querying just because canonical CSV values are available — live data reveals active field usage, error patterns, and configuration state that static references cannot.
44
+
45
+ ## Rootstock Community Research
46
+
47
+ For SYDATAT, SYDATA, SOAPI, and POLOADER questions, always run a Rootstock Community search upfront — do not rely solely on local code or canonical CSVs. These transaction objects have detailed field documentation, import templates, and known-issue articles in the community that are not captured locally.
48
+
49
+ For all other questions, when local code, tests, and org metadata are insufficient, web research is allowed.
50
+
51
+ Treat local project context as potentially incomplete for Rootstock package behavior. If the current repo does not contain enough package-specific evidence, use Rootstock Community search before concluding that an answer is unavailable.
52
+
53
+ Search Rootstock Success Community:
54
+ - https://community.rootstock.com/s/global-search/<searchvalue>
55
+
56
+ If global search returns known issues, case discussions, or solution articles, summarize the top matches and direct the user to those links.
57
+
58
+ Guidelines:
59
+ - Do not fabricate case IDs, issue IDs, or article content when search results are empty or access-limited.
60
+ - If results seem sparse, remind the user that logging in can expand visibility: https://community.rootstock.com/s/login/
61
+ - Import templates for SOAPI, SYDATA/SYDATAT, and POLOADER are often discoverable via global search; direct the user to those template links when found.
62
+ - Do not assume the agent can use the user's browser session automatically; if login-gated pages are needed, ask the user to log in and share links/content that remains inaccessible from tooling.
63
+ - Prefer package/version-neutral findings unless the user asks for a version-specific answer.
64
+ - Treat community findings as supplemental and verify against observed org metadata and behavior before prescribing changes.
65
+ - Before saying information is unknown or unavailable, run at least one Rootstock Community global search query relevant to the user request and summarize what was found (or explicitly that no visible results were returned).
@@ -0,0 +1,41 @@
1
+ # Rootstock Inventory — Item Masters and Inventory State Objects
2
+
3
+ ## Item and Inventory Master Objects
4
+
5
+ - rstk__peitem__c (Engineering Item Master) — top of the item setup chain
6
+ - rstk__icitem__c (Inventory Item Master)
7
+ - rstk__soprod__c (Rootstock Product Master — for sales)
8
+ - rstk__poitem__c (Purchase Item Master — for purchasing)
9
+ - rstk__iclocitem__c (Inventory Item by Location)
10
+ - rstk__icitemlot__c (Inventory by Lot Number)
11
+ - rstk__icitemsrl__c (Inventory Item by Serial Number)
12
+
13
+ ## Item Setup Relationship Chain
14
+
15
+ Follow this order when setting up item records:
16
+ ```
17
+ rstk__peitem__c → rstk__icitem__c → rstk__soprod__c (for sales)
18
+ → rstk__poitem__c (for purchasing)
19
+ ```
20
+
21
+ Treat iclocitem, icitemlot, and icitemsrl as complementary views of inventory availability state — inspect them together when diagnosing inventory balance issues.
22
+
23
+ ## Proactive Org Queries for Inventory Questions
24
+
25
+ ICLocItem (location-level balances):
26
+ ```soql
27
+ SELECT Id, Name, rstk__iclocitem_item__c, rstk__iclocitem_loc__c, rstk__iclocitem_qtyonhand__c
28
+ FROM rstk__iclocitem__c LIMIT 10
29
+ ```
30
+
31
+ Summarize what you found before answering inventory balance questions.
32
+
33
+ ## Inventory Transfer
34
+
35
+ For inventory movements between locations, sites, divisions, or projects, use SYDATAT (rstk__sydatat__c) — not direct DML on iclocitem. Load rootstock-sydatat.md for SYDATAT transaction ID values and patterns.
36
+
37
+ ## Inventory Troubleshooting
38
+
39
+ - Always inspect iclocitem, icitemlot, and icitemsrl together — they represent different facets of the same inventory position.
40
+ - Check that UOM and inventory location records exist before diagnosing balance discrepancies.
41
+ - For inventory-impacting transactions (receipts, issues, adjustments), use SYDATA (rstk__sydata__c) tx types. Load rootstock-sydata.md for SYDATA transaction type values.
@@ -0,0 +1,33 @@
1
+ # Rootstock Manufacturing — Work Orders, Components, and Cost Transactions
2
+
3
+ ## Manufacturing Objects
4
+
5
+ - rstk__wocst__c (Work Order)
6
+ - rstk__woorddmd__c (Work Order Component)
7
+ - rstk__woorddmdcst__c (Work Order Component Detail)
8
+ - rstk__sytxncst__c (Rootstock Cost Transaction)
9
+
10
+ ## Manufacturing Flow Guidance
11
+
12
+ - Work order flows must validate rstk__wocst__c before creating dependent WO component records.
13
+ - WO component detail and cost transaction troubleshooting should verify component quantities, issue status, and costing fields together.
14
+ - Some Rootstock flows require manufacturing user records (rstk__syusr__c) tied to the executing user context — confirm this when WO flows fail unexpectedly.
15
+ - Cost Accounting Control (rstk__csacctcntl__c) must be configured before cost transaction processing.
16
+
17
+ ## Required Setup for Manufacturing Tests
18
+
19
+ Before creating manufacturing test data, confirm these baseline records exist:
20
+ 1. rstk__syconfig__c (system config)
21
+ 2. Company, division, and rstk__syusr__c (manufacturing user linked to the running user)
22
+ 3. Site and division main site assignment
23
+ 4. UOM and default records
24
+ 5. Item setup: rstk__peitem__c → rstk__icitem__c → relevant product masters
25
+ 6. rstk__csacctcntl__c (Cost Accounting Control) for cost transaction flows
26
+
27
+ ## Debugging Manufacturing Issues
28
+
29
+ When diagnosing WO or cost transaction failures:
30
+ 1. Confirm rstk__syusr__c exists for the running user context.
31
+ 2. Confirm component quantities, issue status, and costing fields are set correctly.
32
+ 3. Validate that all required upstream records (wocst → woorddmd → woorddmdcst) exist in the correct order.
33
+ 4. Inspect managed-package trigger side effects before changing business logic.
@@ -0,0 +1,62 @@
1
+ # Rootstock POLOADER — Purchase Order Loader and Purchasing Flows
2
+
3
+ ## POLOADER Processing Object
4
+
5
+ rstk__poloader__c is the PO Loader API object. Use it for:
6
+ - Creating PO headers (Add Header, Add Both)
7
+ - Creating PO lines (Add Line)
8
+ - Changing existing PO headers/lines (Change Header, Change Line, Change Both)
9
+ - Cloning POs (Clone Both, Clone Line)
10
+ - Closing, deleting, and special operations (see mode list below)
11
+
12
+ Prefer background/async processing fields for bulk PO operations to reduce governor-limit pressure.
13
+
14
+ Proactive org query for POLOADER questions:
15
+ ```soql
16
+ SELECT Id, rstk__poloader_mode__c, rstk__poloader_process__c, rstk__poloader_message__c
17
+ FROM rstk__poloader__c
18
+ ORDER BY CreatedDate DESC LIMIT 5
19
+ ```
20
+ Summarize what you found (or that no records exist) before answering.
21
+
22
+ ## POLOADER Mode Values
23
+
24
+ Use exact mode values (case, spacing) when setting rstk__poloader_mode__c. Do not invent or normalize names.
25
+
26
+ Canonical list source: docs/rootstock-poloader-modes.csv
27
+
28
+ Valid values:
29
+ - Add Both
30
+ - Add Header
31
+ - Add Line
32
+ - Change Both
33
+ - Change Header
34
+ - Change Line
35
+ - Clone Both
36
+ - Clone Line
37
+ - Close All Lines Short
38
+ - Close Line Short
39
+ - Delete Both
40
+ - Delete Header
41
+ - Delete Line
42
+ - Revert to Current Spot Rate
43
+ - Sever from Sales Order
44
+ - Submit to Vendor
45
+ - Use Override Schedule
46
+
47
+ If a user provides a POLOADER mode list for their org, treat that org-specific list as authoritative.
48
+
49
+ ## Purchasing Object Chain
50
+
51
+ Key purchasing objects and their relationships:
52
+
53
+ - rstk__pocntl__c (PO Control by division) — must exist before PO header/line creation
54
+ - rstk__pohdr__c (Purchase Order Header)
55
+ - rstk__poline__c (PO Line)
56
+ - rstk__poloader__c (PO Loader API — use for create/change header and lines)
57
+ - rstk__poitem__c (Purchase Item Master)
58
+
59
+ Purchasing flow guidance:
60
+ - Validate rstk__pocntl__c and numbering controls exist before analyzing PO header/line creation issues.
61
+ - Use POLOADER for programmatic PO creation and changes rather than direct DML on pohdr/poline where possible.
62
+ - For item setup, follow peitem → icitem → poitem relationships before creating PO lines.
@@ -0,0 +1,104 @@
1
+ # Rootstock Session — Initialization, MCP Setup, and Agent Updates
2
+
3
+ ## Session Initialization
4
+
5
+ On the first substantive interaction in each session, perform the following checks once and do not repeat them.
6
+
7
+ ### MCP Server Setup
8
+
9
+ Check whether the Salesforce DX MCP server is configured in the workspace:
10
+
11
+ 1. Look for `.vscode/mcp.json` in the workspace root.
12
+ 2. If the file does not exist, or if it exists but does not contain a `"Salesforce DX"` server entry, offer to create or update it with:
13
+
14
+ ```json
15
+ {
16
+ "servers": {
17
+ "Salesforce DX": {
18
+ "command": "npx",
19
+ "args": ["-y", "@salesforce/mcp@latest",
20
+ "--orgs", "DEFAULT_TARGET_ORG",
21
+ "--toolsets", "orgs,metadata,data,users,testing"]
22
+ }
23
+ }
24
+ }
25
+ ```
26
+
27
+ 3. If the user confirms, create or merge the entry into `.vscode/mcp.json`.
28
+ 4. After creating it, tell the user to reload VS Code or restart the MCP server so tools become available.
29
+ 5. Do not create or modify the file without user confirmation.
30
+
31
+ ### Deploy and Test Preferences
32
+
33
+ At the start of any session where Apex or LWC code changes are anticipated, ask the user these two questions once:
34
+
35
+ 1. **Auto-deploy**: "After I make code changes, do you want me to deploy them to the org automatically?"
36
+ 2. **Auto-test**: "After deploying, should I run the relevant Apex tests?"
37
+
38
+ Record the answers as session preferences and apply them for the rest of the conversation:
39
+ - If auto-deploy is **yes**: run `sf project deploy start` targeting the changed files after each implementation step.
40
+ - If auto-test is **yes**: run `sf apex run test` scoped to classes related to the changed code after each deploy.
41
+ - If both are **yes**: deploy first, then run tests, then report results inline.
42
+ - Do not ask these questions again unless the user changes their preference or starts a clearly unrelated task.
43
+
44
+ ## Agent Update Awareness
45
+
46
+ Use lightweight update checks so developers are informed when the shared agent definition changes.
47
+
48
+ Primary source of truth:
49
+ - https://raw.githubusercontent.com/alto-tyler/rootstock-agent-distribution/main/version.json
50
+
51
+ Check cadence:
52
+ - Do not check on every prompt.
53
+ - Check when the user asks about setup/install/update behavior, and otherwise only occasionally (e.g. once per session or after several Rootstock troubleshooting requests).
54
+
55
+ Notification behavior:
56
+ - If remote version is newer than the local installed version, add a short notice with the update command.
57
+ - Keep update notices brief and non-blocking so Rootstock troubleshooting remains primary.
58
+
59
+ ## Agent Upgrade Instructions
60
+
61
+ When a user asks to upgrade the agent, or when an update is detected and the user confirms, run the appropriate command for their OS.
62
+
63
+ ### Windows (PowerShell)
64
+
65
+ ```powershell
66
+ ./scripts/agent/install-rootstock-agent.ps1 -SourceMode remote -BaseUrl "https://raw.githubusercontent.com/alto-tyler/rootstock-agent-distribution/main"
67
+ ```
68
+
69
+ For private distribution repos:
70
+ ```powershell
71
+ $env:GITHUB_TOKEN = "<token-with-repo-read>"
72
+ ./scripts/agent/install-rootstock-agent.ps1 -SourceMode remote -BaseUrl "https://raw.githubusercontent.com/alto-tyler/rootstock-agent-distribution/main"
73
+ ```
74
+
75
+ ### macOS / Linux (requires PowerShell Core)
76
+
77
+ ```bash
78
+ brew install --cask powershell # if pwsh not installed
79
+ pwsh ./scripts/agent/install-rootstock-agent.ps1 -SourceMode remote -BaseUrl "https://raw.githubusercontent.com/alto-tyler/rootstock-agent-distribution/main"
80
+ ```
81
+
82
+ For private repos on Mac:
83
+ ```bash
84
+ export GITHUB_TOKEN="<token-with-repo-read>"
85
+ pwsh ./scripts/agent/install-rootstock-agent.ps1 -SourceMode remote -BaseUrl "https://raw.githubusercontent.com/alto-tyler/rootstock-agent-distribution/main"
86
+ ```
87
+
88
+ ### Check Before Upgrading
89
+
90
+ Windows: `./scripts/agent/check-rootstock-agent-update.ps1`
91
+ macOS/Linux: `pwsh ./scripts/agent/check-rootstock-agent-update.ps1`
92
+
93
+ ### What the Installer Does
94
+
95
+ - Windows: installs to `%APPDATA%\Code\User\prompts\agents\Rootstock Agent.agent.md`
96
+ - macOS: installs to `~/Library/Application Support/Code/User/prompts/agents/Rootstock Agent.agent.md`
97
+ - Also installs supporting docs (field help, certification suite, version manifest) into the same prompts folder.
98
+ - Agent becomes available across all VS Code workspaces after reload.
99
+
100
+ ### After Upgrade
101
+
102
+ 1. Reload VS Code (or open a new chat window).
103
+ 2. Select `Rootstock Agent` in the chat agent picker.
104
+ 3. Verify by asking the agent its current version.
@@ -0,0 +1,57 @@
1
+ # Rootstock SOAPI — Sales Order API Object and Sales Order Flows
2
+
3
+ ## SOAPI Processing Object
4
+
5
+ rstk__soapi__c is the Sales Order API object. Use it for:
6
+ - Creating sales orders (Add Header, Add Both)
7
+ - Creating sales order lines (Add Line)
8
+ - Changing existing order headers/lines (Change Header, Change Line, Change Both)
9
+ - Deleting headers/lines (Delete Header, Delete Line, Delete Both)
10
+
11
+ If rstk Application Settings has soapi_bulksoapis = true, bulk SOAPI processing can group related rows by Upload Group.
12
+ - For grouped bulk creation, the header row must be processed before its related line rows.
13
+ - Prefer background/async processing fields for high-volume loads.
14
+
15
+ Proactive org query for SOAPI questions:
16
+ ```soql
17
+ SELECT Id, rstk__soapi_mode__c, rstk__soapi_process__c, rstk__soapi_message__c
18
+ FROM rstk__soapi__c
19
+ ORDER BY CreatedDate DESC LIMIT 5
20
+ ```
21
+ Summarize what you found (or that no records exist) before answering.
22
+
23
+ ## SOAPI Mode Values
24
+
25
+ Use exact mode values (case, spacing) when setting rstk__soapi_mode__c. Do not invent or normalize names.
26
+
27
+ Canonical list source: docs/rootstock-soapi-modes.csv
28
+
29
+ Valid values:
30
+ - Add Header
31
+ - Add Both
32
+ - Add Line
33
+ - Change Header
34
+ - Change Both
35
+ - Change Line
36
+ - Delete Line
37
+ - Delete Both
38
+ - Delete Header
39
+
40
+ Header rows must be inserted before their related line rows when using Upload Group.
41
+
42
+ ## Sales Order Object Chain
43
+
44
+ When Rootstock sales-order records are created directly or indirectly, use this dependency order:
45
+
46
+ 1. rstk__sohdr__c (Sales Order Header)
47
+ 2. rstk__soline__c (Sales Order Line)
48
+ 3. rstk__soorddmd__c (Line Demand) — when demand/issue logic is involved
49
+ 4. rstk__soship__c (Shipment) — when fulfillment/ship logic is involved
50
+ 5. rstk__sohdrpay__c (Payment/Prepayment) — when payment logic is involved
51
+
52
+ Known constraints and gotchas:
53
+ - rstk__soorddmd__c inserts must set rstk__soorddmd_qtyper__c > 0.
54
+ - rstk__soship__c.rstk__soship_shipper__c is a required DOUBLE (Shipper Number), not a lookup.
55
+ - Certain Rootstock computed fields are read-only in tests; set writable upstream fields instead.
56
+ - Duplicate prevention should consider existing sohdr/soline combinations before adding new SOAPI-driven records.
57
+ - Sales control configuration (rstk__socntl__c) must exist before SOAPI/sales-order creation.
@@ -0,0 +1,47 @@
1
+ # Rootstock SYDATA — Inventory and Cost Transaction Processor
2
+
3
+ ## SYDATA Processing Object
4
+
5
+ rstk__sydata__c is the background processor for inventory-balance-impacting and cost-impacting activity. Use it for:
6
+ - PO receipts
7
+ - Labor bookings
8
+ - WO closure
9
+ - Processing async transactions queued by SOAPI, POLOADER, SYDATAT, and related transaction objects
10
+
11
+ Prefer background/async processing fields when batching transactions to reduce Salesforce governor-limit pressure.
12
+
13
+ Proactive org query for SYDATA questions:
14
+ ```soql
15
+ SELECT Id, rstk__sydata_txntype__c, rstk__sydata_process__c, rstk__sydata_message__c
16
+ FROM rstk__sydata__c
17
+ ORDER BY CreatedDate DESC LIMIT 5
18
+ ```
19
+ Summarize what you found (or that no records exist) before answering.
20
+
21
+ ## SYDATA Transaction Types
22
+
23
+ Use exact transaction type values (case, spacing, punctuation) when setting rstk__sydata_txntype__c. Do not invent or normalize names.
24
+
25
+ Canonical list source: docs/rootstock-sydata-txn-types.csv
26
+
27
+ Important values to recognize and use exactly:
28
+ - Loc Add
29
+ - Loc Adjust
30
+ - Loc Scrap
31
+ - Process Async SOAPIs
32
+ - Process BULK Async SOAPIs
33
+ - Process Async POLOADERs
34
+ - Sales Order Pick-Pack-Ship
35
+ - PO Receipt
36
+ - Labor Booking
37
+ - WO Close
38
+
39
+ If a user provides a SYDATA transaction type list for their org, treat that org-specific list as authoritative over assumptions.
40
+
41
+ ## Relationship to Other Transaction Objects
42
+
43
+ - SYDATA acts as the async processor for transactions queued by SOAPI, POLOADER, and SYDATAT.
44
+ - SYDATA and SYDATAT are separate objects with different purposes:
45
+ - SYDATA = inventory/cost transaction processor (receipts, bookings, closures, async queue processing)
46
+ - SYDATAT = inventory transfer transaction object (moving inventory between locations/sites/divisions)
47
+ - Do not conflate SYDATA and SYDATAT. Load rootstock-sydatat.md if the question involves inventory transfers between locations, sites, or divisions.
@@ -0,0 +1,40 @@
1
+ # Rootstock SYDATAT — Inventory Transfer Transaction Object
2
+
3
+ ## SYDATAT Processing Object
4
+
5
+ rstk__sydatat__c is the transaction object used to move inventory between locations, sites, and divisions. It is a distinct object from SYDATA.
6
+
7
+ - Use SYDATAT specifically for inventory transfer movements (location-to-location, site-to-site, division-to-division, project-to-project).
8
+ - Do not use SYDATA for inventory transfers — SYDATAT is the correct object for this purpose.
9
+ - When SYDATAT runs in async/background mode, SYDATA can process those queued transfer transactions.
10
+ - Prefer background/async processing fields for bulk transfer operations to reduce governor-limit pressure.
11
+
12
+ Proactive org query for SYDATAT questions:
13
+ ```soql
14
+ SELECT Id, rstk__sydatat_txnid__c, rstk__sydatat_process__c, rstk__sydatat_message__c
15
+ FROM rstk__sydatat__c
16
+ ORDER BY CreatedDate DESC LIMIT 5
17
+ ```
18
+ Summarize what you found (or that no records exist) before answering.
19
+
20
+ ## SYDATAT Transaction ID Values
21
+
22
+ Use exact Transaction ID values (case, no spaces) when setting rstk__sydatat_txnid__c. Do not invent or normalize names.
23
+
24
+ Canonical list source: docs/rootstock-sydatat-txn-id.csv
25
+
26
+ Valid values:
27
+ - INVDIVDIV (division to division transfer)
28
+ - INVSITESITE (site to site transfer)
29
+ - INVPROJPROJ (project to project transfer)
30
+ - INVLOCLOC (location to location transfer)
31
+
32
+ If a user provides a SYDATAT transaction ID list for their org, treat that org-specific list as authoritative.
33
+
34
+ ## Relationship to SYDATA
35
+
36
+ SYDATAT and SYDATA are two separate processing objects:
37
+ - SYDATAT = initiates inventory transfer movements between locations/sites/divisions/projects
38
+ - SYDATA = background processor that can execute async SYDATAT queued transactions (among other tx types)
39
+
40
+ For questions about PO receipts, labor bookings, WO closure, or async queue processing, load rootstock-sydata.md instead.
@@ -0,0 +1,63 @@
1
+ # Rootstock Testing — Factories, Setup Sequence, and Coverage Rules
2
+
3
+ ## Rootstock Data Factory Sources
4
+
5
+ When users need Rootstock test setup, point them to one of these two factory options:
6
+
7
+ 1. Preferred (current): private repo
8
+ - https://github.com/alto-tyler/RstkConfigTestDataFactory
9
+ 2. Fallback/reference (legacy public):
10
+ - https://github.com/alto-tyler/SalesforceDevLibrary/tree/main/Rootstock%20Test%20Data%20Factory
11
+
12
+ If the user does not yet have the preferred private factory in their org/repo:
13
+ - Explicitly tell them where to get it (private repo above).
14
+ - After they add it, read and follow that factory's usage instructions (README/tests/configurator patterns) before proposing setup code.
15
+ - Prefer configurator-driven generation (e.g. RstkObjectConfigurator) when available in that factory.
16
+
17
+ Financial coverage note:
18
+ - Current factories do not cover Rootstock financial setup.
19
+ - Do not block or refuse help when financial setup is missing; continue helping and ask for targeted user guidance where needed.
20
+ - There is currently no approved shared financial seed source to rely on by default.
21
+
22
+ ## When Factories Are Required
23
+
24
+ - If code touches Rootstock package objects/automation (rstk__, rstkf__, Rootstock DOX), advise using one of the two Rootstock data factories.
25
+ - If code is custom-only and does not touch Rootstock package behavior, Rootstock factory setup is optional and usually unnecessary.
26
+ - Baseline required setup should come from what is already covered by the two existing data factories.
27
+
28
+ ## Required Baseline Setup Sequence
29
+
30
+ When creating Rootstock-dependent test data, follow this proven setup order:
31
+
32
+ 1. Create/verify syconfig (rstk__syconfig__c — Rootstock system config).
33
+ 2. Create currency, company, division, and manufacturing user linkage (rstk__syusr__c).
34
+ 3. Create site and set division main site.
35
+ 4. Create UOM + default records + inventory location records.
36
+ 5. Create commodity/item/accounting scaffolding before transactional objects.
37
+ 6. Create sales control configuration (rstk__socntl__c) before SOAPI/sales-order creation.
38
+
39
+ ## Key Test Patterns
40
+
41
+ - Use @testSetup and batchable setup patterns for heavy Rootstock test data.
42
+ - Always set namespace-specific trigger options in test methods only:
43
+ - rstk__ objects: rstk__triggeroptions__c = 'UT'
44
+ - rstkf__ objects: rstkf__triggeroptions__c = 'UT'
45
+ - Never set in production code.
46
+ - UT suppresses Rootstock auto-created related records — create required related records explicitly in your test setup.
47
+ - Some Rootstock flows require manufacturing user records (rstk__syusr__c) tied to the executing user context.
48
+ - Rootstock package insert behavior can clear or overwrite some error fields; preserve intended messages when needed.
49
+ - Always advise against SeeAllData=true for Rootstock test development.
50
+
51
+ ## Code Coverage Requirement
52
+
53
+ - Every Apex class written or modified must have 75% or greater code coverage.
54
+ - Before finalising any Apex implementation, verify coverage is reachable with the test methods provided.
55
+ - If a class is below 75%, add test cases to cover the missing branches before declaring the implementation complete.
56
+ - Do not rely on RunLocalTests aggregate coverage — check the specific class coverage for each class changed.
57
+ - When running tests, use --code-coverage and confirm the per-class coverage in the output.
58
+
59
+ ## Testing Strategy
60
+
61
+ - Prefer targeted test runs for Rootstock-touching classes after each change.
62
+ - Treat aggregate Apex coverage metrics as potentially stale after deploy/redeploy; rely on fresh test execution.
63
+ - For failing Rootstock DML in bulk operations, consider controlled retry strategies (e.g. single-row retries) when behavior indicates transient package-level contention.