agent-docs 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/plans/OPTIMISE.md +379 -0
- package/.cursor/plans/VERSIONING.md +207 -0
- package/.cursor/rules/IMPORTANT.mdc +97 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +13 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
- package/.github/dependabot.yml +38 -0
- package/.github/pull_request_template.md +10 -0
- package/.github/workflows/format.yml +35 -0
- package/CODE_OF_CONDUCT.md +64 -0
- package/CONTRIBUTING.md +52 -0
- package/LICENSE.md +20 -0
- package/PLAN.md +707 -0
- package/README.md +133 -0
- package/SECURITY.md +21 -0
- package/docs/APEXANNOTATIONS.md +472 -0
- package/docs/APEXDOC.md +198 -0
- package/docs/CML.md +877 -0
- package/docs/CODEANALYZER.md +435 -0
- package/docs/CONTEXTDEFINITIONS.md +617 -0
- package/docs/ESLINT.md +827 -0
- package/docs/ESLINTJSDOC.md +520 -0
- package/docs/FIELDSERVICE.md +4452 -0
- package/docs/GRAPHBINARY.md +208 -0
- package/docs/GRAPHENGINE.md +616 -0
- package/docs/GRAPHML.md +337 -0
- package/docs/GRAPHSON.md +302 -0
- package/docs/GREMLIN.md +490 -0
- package/docs/GRYO.md +232 -0
- package/docs/HUSKY.md +106 -0
- package/docs/JEST.md +387 -0
- package/docs/JORJE.md +537 -0
- package/docs/JSDOC.md +621 -0
- package/docs/PMD.md +910 -0
- package/docs/PNPM.md +409 -0
- package/docs/PRETTIER.md +716 -0
- package/docs/PRETTIERAPEX.md +874 -0
- package/docs/REVENUETRANSACTIONMANAGEMENT.md +887 -0
- package/docs/TINKERPOP.md +252 -0
- package/docs/VITEST.md +706 -0
- package/docs/VSCODE.md +231 -0
- package/docs/XPATH31.md +213 -0
- package/package.json +32 -0
- package/postinstall.mjs +51 -0
- package/prettier.config.js +18 -0
package/docs/VSCODE.md
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# VS Code Extension for Code Analyzer
|
|
2
|
+
|
|
3
|
+
> **Version**: 1.0.0
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Salesforce Code Analyzer Visual Studio Code Extension integrates Code
|
|
8
|
+
Analyzer's static analysis capabilities directly into the VS Code environment,
|
|
9
|
+
providing real-time feedback and code scanning during development.
|
|
10
|
+
|
|
11
|
+
**Reference:**
|
|
12
|
+
[Use the VS Code Extension to Analyze Your Code](https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/analyze-vscode.html)
|
|
13
|
+
|
|
14
|
+
## Prerequisites
|
|
15
|
+
|
|
16
|
+
- Visual Studio Code installed
|
|
17
|
+
- Salesforce CLI installed and configured
|
|
18
|
+
- Salesforce Extensions for VS Code installed
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
### Step 1: Install Salesforce CLI
|
|
23
|
+
|
|
24
|
+
Ensure Salesforce CLI is installed on your system:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
sf --version
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
If not installed, download from
|
|
31
|
+
[Salesforce CLI](https://developer.salesforce.com/tools/salesforcecli).
|
|
32
|
+
|
|
33
|
+
### Step 2: Install Salesforce Extensions for VS Code
|
|
34
|
+
|
|
35
|
+
The Code Analyzer extension is included in the Salesforce Extensions for VS Code
|
|
36
|
+
extension pack:
|
|
37
|
+
|
|
38
|
+
1. Open VS Code
|
|
39
|
+
2. Go to Extensions view (Ctrl+Shift+X / Cmd+Shift+X)
|
|
40
|
+
3. Search for "Salesforce Extension Pack"
|
|
41
|
+
4. Click Install
|
|
42
|
+
|
|
43
|
+
Alternatively, install the Code Analyzer extension directly by searching for
|
|
44
|
+
"Salesforce Code Analyzer".
|
|
45
|
+
|
|
46
|
+
### Step 3: Install Code Analyzer CLI Plugin
|
|
47
|
+
|
|
48
|
+
The VS Code extension requires the Code Analyzer CLI plugin. Install it via
|
|
49
|
+
terminal:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
sf plugins install @salesforce/sfdx-scanner
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Or open the VS Code integrated terminal (Ctrl+` / Cmd+`) and run:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
sf plugins install @salesforce/sfdx-scanner
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Verify installation:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
sf scanner --help
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Usage
|
|
68
|
+
|
|
69
|
+
### Scan Selected Files or Folders
|
|
70
|
+
|
|
71
|
+
1. In VS Code Explorer, select one or more files or folders
|
|
72
|
+
2. Right-click the selection
|
|
73
|
+
3. Choose **"SFDX: Scan Selected Files or Folders with Code Analyzer"**
|
|
74
|
+
|
|
75
|
+
The extension will analyze the selected items and display results in the
|
|
76
|
+
Problems panel.
|
|
77
|
+
|
|
78
|
+
### Scan Current File
|
|
79
|
+
|
|
80
|
+
1. Open a file in the editor
|
|
81
|
+
2. Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
|
|
82
|
+
3. Type and select **"SFDX: Scan Current File with Code Analyzer"**
|
|
83
|
+
|
|
84
|
+
The current file will be analyzed and violations will be shown in the Problems
|
|
85
|
+
panel.
|
|
86
|
+
|
|
87
|
+
### Scan Workspace
|
|
88
|
+
|
|
89
|
+
To scan the entire workspace:
|
|
90
|
+
|
|
91
|
+
1. Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
|
|
92
|
+
2. Type and select **"SFDX: Scan Workspace with Code Analyzer"**
|
|
93
|
+
|
|
94
|
+
## Viewing Results
|
|
95
|
+
|
|
96
|
+
### Problems Panel
|
|
97
|
+
|
|
98
|
+
After scanning, results are displayed in the **Problems** panel (View → Problems
|
|
99
|
+
or Ctrl+Shift+M / Cmd+Shift+M):
|
|
100
|
+
|
|
101
|
+
- **Severity**: Indicated by icon color (Error/Warning/Info)
|
|
102
|
+
- **File**: Click to navigate to the violation location
|
|
103
|
+
- **Rule**: Rule name and description
|
|
104
|
+
- **Line**: Line number where violation occurs
|
|
105
|
+
- **Message**: Detailed violation message
|
|
106
|
+
|
|
107
|
+
### Inline Annotations
|
|
108
|
+
|
|
109
|
+
Violations appear as inline annotations in the editor:
|
|
110
|
+
|
|
111
|
+
- Red squiggles for errors (High/Critical severity)
|
|
112
|
+
- Yellow squiggles for warnings (Moderate severity)
|
|
113
|
+
- Blue squiggles for info (Low/Info severity)
|
|
114
|
+
|
|
115
|
+
Hover over annotations to see detailed violation information.
|
|
116
|
+
|
|
117
|
+
### Quick Actions
|
|
118
|
+
|
|
119
|
+
Right-click on a violation in the Problems panel or editor to access:
|
|
120
|
+
|
|
121
|
+
- **Go to Definition**: Navigate to rule definition
|
|
122
|
+
- **View Rule Details**: See full rule documentation
|
|
123
|
+
- **Copy Violation**: Copy violation details to clipboard
|
|
124
|
+
|
|
125
|
+
## Configuration
|
|
126
|
+
|
|
127
|
+
### Extension Settings
|
|
128
|
+
|
|
129
|
+
Configure Code Analyzer extension behavior via VS Code settings:
|
|
130
|
+
|
|
131
|
+
1. Open Settings (Ctrl+, / Cmd+,)
|
|
132
|
+
2. Search for "Salesforce Code Analyzer"
|
|
133
|
+
|
|
134
|
+
Available settings:
|
|
135
|
+
|
|
136
|
+
- **Enable/Disable**: Toggle Code Analyzer on/off
|
|
137
|
+
- **Auto-scan on Save**: Automatically scan files when saved
|
|
138
|
+
- **Default Engine**: Set default engine for scanning
|
|
139
|
+
- **Severity Mapping**: Map Code Analyzer severities to VS Code severities
|
|
140
|
+
- **Excluded Patterns**: Patterns to exclude from scanning
|
|
141
|
+
|
|
142
|
+
### Project Configuration
|
|
143
|
+
|
|
144
|
+
The extension respects `code-analyzer.yml` configuration in your project root.
|
|
145
|
+
For detailed configuration options, see
|
|
146
|
+
[Code Analyzer Configuration](CODEANALYZER.md).
|
|
147
|
+
|
|
148
|
+
Example `code-analyzer.yml`:
|
|
149
|
+
|
|
150
|
+
```yaml
|
|
151
|
+
engines:
|
|
152
|
+
pmd:
|
|
153
|
+
custom_rulesets:
|
|
154
|
+
- rulesets/design/InnerClassesCannotBeStatic.xml
|
|
155
|
+
|
|
156
|
+
rules:
|
|
157
|
+
pmd:
|
|
158
|
+
NoSingleLetterVariableNames:
|
|
159
|
+
severity: 'High'
|
|
160
|
+
tags: ['Recommended']
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Keyboard Shortcuts
|
|
164
|
+
|
|
165
|
+
Default keyboard shortcuts:
|
|
166
|
+
|
|
167
|
+
- **Scan Current File**: Not assigned by default (use Command Palette)
|
|
168
|
+
- **Scan Selected Files**: Not assigned by default (use context menu)
|
|
169
|
+
|
|
170
|
+
You can assign custom shortcuts via:
|
|
171
|
+
|
|
172
|
+
1. File → Preferences → Keyboard Shortcuts (Ctrl+K Ctrl+S / Cmd+K Cmd+S)
|
|
173
|
+
2. Search for "Salesforce Code Analyzer"
|
|
174
|
+
3. Assign desired shortcuts
|
|
175
|
+
|
|
176
|
+
## Troubleshooting
|
|
177
|
+
|
|
178
|
+
### Extension Not Working
|
|
179
|
+
|
|
180
|
+
1. Verify Salesforce CLI is installed and in PATH
|
|
181
|
+
2. Verify Code Analyzer plugin is installed: `sf plugins list`
|
|
182
|
+
3. Check VS Code Output panel for errors (View → Output, select "Salesforce Code
|
|
183
|
+
Analyzer")
|
|
184
|
+
4. Reload VS Code window (Ctrl+Shift+P → "Developer: Reload Window")
|
|
185
|
+
|
|
186
|
+
### No Results Displayed
|
|
187
|
+
|
|
188
|
+
1. Verify files are supported file types (`.cls`, `.trigger`, `.js`, `.ts`,
|
|
189
|
+
`.html`, `.cmp`, etc.)
|
|
190
|
+
2. Check `code-analyzer.yml` configuration
|
|
191
|
+
3. Verify rules are enabled and not filtered out
|
|
192
|
+
4. Check VS Code Output panel for scanning errors
|
|
193
|
+
|
|
194
|
+
### Slow Performance
|
|
195
|
+
|
|
196
|
+
1. Exclude unnecessary files via `code-analyzer.yml` patterns
|
|
197
|
+
2. Disable auto-scan on save for large workspaces
|
|
198
|
+
3. Scan individual files/folders instead of entire workspace
|
|
199
|
+
4. Check system resources (CPU, memory)
|
|
200
|
+
|
|
201
|
+
### Plugin Not Found
|
|
202
|
+
|
|
203
|
+
If extension reports CLI plugin not found:
|
|
204
|
+
|
|
205
|
+
1. Verify plugin installation: `sf plugins list | grep scanner`
|
|
206
|
+
2. Reinstall plugin: `sf plugins install @salesforce/sfdx-scanner --force`
|
|
207
|
+
3. Check Salesforce CLI version compatibility
|
|
208
|
+
4. Restart VS Code
|
|
209
|
+
|
|
210
|
+
## Best Practices
|
|
211
|
+
|
|
212
|
+
1. **Configure Rules**: Customize `code-analyzer.yml` to match your team's
|
|
213
|
+
standards
|
|
214
|
+
2. **Regular Scanning**: Scan code regularly during development, not just before
|
|
215
|
+
commits
|
|
216
|
+
3. **Fix High Priority**: Address High and Critical severity violations first
|
|
217
|
+
4. **Use Tags**: Leverage rule tags (e.g., "Recommended") to focus on important
|
|
218
|
+
rules
|
|
219
|
+
5. **Review Results**: Don't blindly fix all violations; understand rule
|
|
220
|
+
rationale
|
|
221
|
+
6. **Exclude Patterns**: Exclude generated files and third-party code from
|
|
222
|
+
scanning
|
|
223
|
+
|
|
224
|
+
## Related Documentation
|
|
225
|
+
|
|
226
|
+
- **[CLI Commands](CODEANALYZER.md#cli-commands)** - Command-line usage of Code
|
|
227
|
+
Analyzer
|
|
228
|
+
- **[Code Analyzer Configuration](CODEANALYZER.md)** - Complete configuration
|
|
229
|
+
reference
|
|
230
|
+
- **[PMD Engine](PMD.md)** - PMD rules and configuration
|
|
231
|
+
- **[ESLint Engine](ESLINT.md)** - ESLint rules for JavaScript/TypeScript/LWC
|
package/docs/XPATH31.md
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
````markdown
|
|
2
|
+
# XPath 3.1 Reference
|
|
3
|
+
|
|
4
|
+
> **Version**: 1.0.0
|
|
5
|
+
|
|
6
|
+
## Core
|
|
7
|
+
|
|
8
|
+
- **Model:** Sequences of items (nodes, atomics, maps, arrays, functions). `()`
|
|
9
|
+
= empty.
|
|
10
|
+
- **Context:** `.` (current), `position()`, `last()`, `$var`
|
|
11
|
+
- **Paths:** `/` (root), `//` (descendant-or-self), `..` (parent), `@`
|
|
12
|
+
(attribute)
|
|
13
|
+
|
|
14
|
+
## Operators
|
|
15
|
+
|
|
16
|
+
| Type | Operators |
|
|
17
|
+
| ----------- | --------------------------------------------------------------------- |
|
|
18
|
+
| Arithmetic | `+ - * div idiv mod` |
|
|
19
|
+
| Value cmp | `= != < <= > >=` (atomizes) |
|
|
20
|
+
| General cmp | `eq ne lt le gt ge` (singleton) |
|
|
21
|
+
| Logical | `and or not()` |
|
|
22
|
+
| Other | `\|\|` (concat), `!` (map), `?` (lookup), `:=` (assign), `=>` (arrow) |
|
|
23
|
+
| Type | `instance of`, `cast as`, `castable as`, `treat as` |
|
|
24
|
+
|
|
25
|
+
## Axes
|
|
26
|
+
|
|
27
|
+
`child::` (default), `descendant::`, `descendant-or-self::` (//), `parent::`
|
|
28
|
+
(..), `ancestor::`, `ancestor-or-self::`, `following-sibling::`,
|
|
29
|
+
`preceding-sibling::`, `following::`, `preceding::`, `attribute::` (@),
|
|
30
|
+
`namespace::`, `self::` (.)
|
|
31
|
+
|
|
32
|
+
## Node Tests
|
|
33
|
+
|
|
34
|
+
`*` (any element), `node()`, `text()`, `comment()`, `processing-instruction()`,
|
|
35
|
+
`element(name?)`, `attribute(name?)`, `document-node()`
|
|
36
|
+
|
|
37
|
+
## Predicates
|
|
38
|
+
|
|
39
|
+
`[1]` (first), `[last()]`, `[position()=1]`, `[@attr='val']`, `[count(x)>0]`,
|
|
40
|
+
`[some $x in y satisfies cond]`
|
|
41
|
+
|
|
42
|
+
## Functions
|
|
43
|
+
|
|
44
|
+
### String
|
|
45
|
+
|
|
46
|
+
`concat`, `substring($s,$start,$len?)`, `string-length`, `contains`,
|
|
47
|
+
`starts-with`, `ends-with`, `matches($s,$regex)`, `replace($s,$pat,$repl)`,
|
|
48
|
+
`lower-case`, `upper-case`, `normalize-space`, `substring-before`,
|
|
49
|
+
`substring-after`
|
|
50
|
+
|
|
51
|
+
### Numeric
|
|
52
|
+
|
|
53
|
+
`count`, `sum`, `avg`, `min`, `max`, `abs`, `floor`, `ceiling`, `round`
|
|
54
|
+
|
|
55
|
+
### Boolean
|
|
56
|
+
|
|
57
|
+
`not`, `true`, `false`, `empty`, `exists`
|
|
58
|
+
|
|
59
|
+
### Sequence
|
|
60
|
+
|
|
61
|
+
`distinct-values`, `reverse`, `subsequence($seq,$start,$len?)`, `index-of`,
|
|
62
|
+
`remove($seq,$pos)`, `insert-before`, `head`, `tail`
|
|
63
|
+
|
|
64
|
+
### Node
|
|
65
|
+
|
|
66
|
+
`name`, `local-name`, `namespace-uri`, `root`
|
|
67
|
+
|
|
68
|
+
### Type
|
|
69
|
+
|
|
70
|
+
`data`, `string`, `number`, `boolean`
|
|
71
|
+
|
|
72
|
+
## Maps
|
|
73
|
+
|
|
74
|
+
```xpath
|
|
75
|
+
map { 'k': v } # Constructor
|
|
76
|
+
$m('k') $m?k $m?('k') ?k # Lookup
|
|
77
|
+
map:keys map:contains map:get map:put map:remove map:size map:merge map:entry
|
|
78
|
+
```
|
|
79
|
+
````
|
|
80
|
+
|
|
81
|
+
## Arrays
|
|
82
|
+
|
|
83
|
+
```xpath
|
|
84
|
+
[v1, v2] array { $a, $b } # Constructor (1-based)
|
|
85
|
+
$a(1) $a?1 ?1 ?* # Lookup (?* = all/flatten)
|
|
86
|
+
array:size array:get array:put array:append array:subarray array:remove
|
|
87
|
+
array:reverse array:join array:flatten array:for-each array:filter array:fold-left/right
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Expressions
|
|
91
|
+
|
|
92
|
+
### Conditional
|
|
93
|
+
|
|
94
|
+
```xpath
|
|
95
|
+
if ($cond) then $a else $b
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Quantified
|
|
99
|
+
|
|
100
|
+
```xpath
|
|
101
|
+
some $v in $seq satisfies $expr # exists
|
|
102
|
+
every $v in $seq satisfies $expr # forall
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Let (comma-separated bindings preferred)
|
|
106
|
+
|
|
107
|
+
```xpath
|
|
108
|
+
let $a := 1, $b := 2 return $a + $b
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### For
|
|
112
|
+
|
|
113
|
+
```xpath
|
|
114
|
+
for $i in (1 to 10) return $i * 2
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Arrow
|
|
118
|
+
|
|
119
|
+
```xpath
|
|
120
|
+
$seq => distinct-values() => reverse() # = reverse(distinct-values($seq))
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Simple Map
|
|
124
|
+
|
|
125
|
+
```xpath
|
|
126
|
+
$seq ! (./child/@attr) # apply to each, flatten
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Common Patterns
|
|
130
|
+
|
|
131
|
+
### Basic
|
|
132
|
+
|
|
133
|
+
```xpath
|
|
134
|
+
//Node[@Attr='val'] # attr match
|
|
135
|
+
//Parent[child/@a='v'] # child condition
|
|
136
|
+
//Node[ancestor::Class[@Name='X']] # ancestor check
|
|
137
|
+
//Node[following-sibling::Node[@T='x']] # sibling check
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### With let (must be parenthesized in predicates)
|
|
141
|
+
|
|
142
|
+
```xpath
|
|
143
|
+
//Node[
|
|
144
|
+
condition1
|
|
145
|
+
and (
|
|
146
|
+
let $v := @Attr
|
|
147
|
+
return count(following-sibling::Node[@Attr=$v]) >= 2
|
|
148
|
+
)
|
|
149
|
+
]
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Ancestor scope aggregation
|
|
153
|
+
|
|
154
|
+
```xpath
|
|
155
|
+
//IfBlock[
|
|
156
|
+
let $method := ancestor::Method[1],
|
|
157
|
+
$all := $method//IfBlock
|
|
158
|
+
return count($all) >= 5
|
|
159
|
+
]
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Sum with conditional for
|
|
163
|
+
|
|
164
|
+
```xpath
|
|
165
|
+
//Node[
|
|
166
|
+
let $var := @Image, $method := ancestor::Method[1]
|
|
167
|
+
return sum(
|
|
168
|
+
for $b in $method//Node return
|
|
169
|
+
if (exists($b/X)) then count($b//Y[@V=$var]) else 0
|
|
170
|
+
) >= 5
|
|
171
|
+
]
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Consecutive siblings
|
|
175
|
+
|
|
176
|
+
```xpath
|
|
177
|
+
//Node[
|
|
178
|
+
@A='v'
|
|
179
|
+
and not(preceding-sibling::*[1][self::Node[@A=current()/@A]])
|
|
180
|
+
and (let $a := @A return count(following-sibling::Node[@A=$a]) + 1 >= 2)
|
|
181
|
+
]
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Quantified with parentheses (required with and/or)
|
|
185
|
+
|
|
186
|
+
```xpath
|
|
187
|
+
//Node[
|
|
188
|
+
(some $x in $s1 satisfies $x/@v='a')
|
|
189
|
+
and not((some $y in $s2 satisfies $y/@v='b'))
|
|
190
|
+
]
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Pitfalls
|
|
194
|
+
|
|
195
|
+
| Issue | Solution |
|
|
196
|
+
| -------------------------- | ----------------------------------------------------- |
|
|
197
|
+
| `let` in predicate | Wrap in parens: `cond and (let $x:=... return ...)` |
|
|
198
|
+
| `let` in `not()` | Restructure: use `some`/`every` or move `let` outside |
|
|
199
|
+
| `some`/`every` after `and` | Wrap quantifier: `and (some $x in...)` |
|
|
200
|
+
| `tokenize('')` | Check `string-length($s)>0` first |
|
|
201
|
+
| Nested `let` | Use comma-separated: `let $a:=1, $b:=2 return...` |
|
|
202
|
+
|
|
203
|
+
## Notes
|
|
204
|
+
|
|
205
|
+
- Atomization: comparisons auto-atomize
|
|
206
|
+
- EBV: non-empty seq = true (except `""`, `0`, `NaN`, `false()`)
|
|
207
|
+
- Document order preserved
|
|
208
|
+
- Namespaces: prefixes or `Q{uri}local`
|
|
209
|
+
- Errors: `try/catch` in 3.1
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agent-docs",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "A tool for generating reusable, low-token AI agent instruction documents",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"ai",
|
|
8
|
+
"agent",
|
|
9
|
+
"documentation",
|
|
10
|
+
"docs",
|
|
11
|
+
"ide",
|
|
12
|
+
"cursor"
|
|
13
|
+
],
|
|
14
|
+
"author": "starch-uk",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/starch-uk/agent-docs.git"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"prettier": "^3.7.4"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=20.0.0"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"format": "prettier --write \"**/*.{ts,md,json,yml,yaml}\"",
|
|
28
|
+
"format:fix": "prettier --write \"**/*.{ts,md,json,yml,yaml}\"",
|
|
29
|
+
"format:check": "prettier --check \"**/*.{ts,md,json,yml,yaml}\"",
|
|
30
|
+
"postinstall": "node postinstall.mjs"
|
|
31
|
+
}
|
|
32
|
+
}
|
package/postinstall.mjs
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import url from 'url';
|
|
4
|
+
|
|
5
|
+
const __filename = url.fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = path.dirname(__filename);
|
|
7
|
+
|
|
8
|
+
// Root of the installed package
|
|
9
|
+
const packageRoot = __dirname;
|
|
10
|
+
|
|
11
|
+
// Root of the consumer project (where npm/pnpm/yarn runs postinstall)
|
|
12
|
+
const consumerRoot = process.cwd();
|
|
13
|
+
|
|
14
|
+
// This package's docs directory
|
|
15
|
+
const packageDocsDir = path.join(packageRoot, 'docs');
|
|
16
|
+
|
|
17
|
+
// The docs directory in the consumer project
|
|
18
|
+
const consumerDocsDir = path.join(consumerRoot, 'docs');
|
|
19
|
+
|
|
20
|
+
async function main() {
|
|
21
|
+
try {
|
|
22
|
+
// Ensure this package actually has a docs directory
|
|
23
|
+
const pkgDocsStats = await fs.promises.stat(packageDocsDir).catch(() => null);
|
|
24
|
+
if (!pkgDocsStats || !pkgDocsStats.isDirectory()) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// If the consumer already has a docs directory, do nothing
|
|
29
|
+
const consumerDocsStats = await fs.promises.stat(consumerDocsDir).catch(() => null);
|
|
30
|
+
if (consumerDocsStats) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const isWindows = process.platform === 'win32';
|
|
35
|
+
|
|
36
|
+
if (isWindows) {
|
|
37
|
+
// On Windows, create a junction from consumerRoot/docs to this package's docs
|
|
38
|
+
// Junction target must be an absolute path
|
|
39
|
+
await fs.promises.symlink(packageDocsDir, consumerDocsDir, 'junction');
|
|
40
|
+
} else {
|
|
41
|
+
// On POSIX, create a directory symlink
|
|
42
|
+
await fs.promises.symlink(packageDocsDir, consumerDocsDir, 'dir');
|
|
43
|
+
}
|
|
44
|
+
} catch {
|
|
45
|
+
// Never fail install because of docs-linking issues
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
main();
|
|
50
|
+
|
|
51
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @type {import('prettier').Config} */
|
|
2
|
+
export default {
|
|
3
|
+
"semi": true,
|
|
4
|
+
"singleQuote": true,
|
|
5
|
+
"trailingComma": "all",
|
|
6
|
+
"printWidth": 80,
|
|
7
|
+
"proseWrap": "always",
|
|
8
|
+
"tabWidth": 4,
|
|
9
|
+
"useTabs": true,
|
|
10
|
+
"overrides": [
|
|
11
|
+
{
|
|
12
|
+
"files": ".github/workflows/**/*.{yml,yaml}",
|
|
13
|
+
"options": {
|
|
14
|
+
"proseWrap": "preserve"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
};
|