sfcc-metadata-cli 0.0.1 → 1.0.1

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.
@@ -0,0 +1,78 @@
1
+ name: Check
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ permissions:
8
+ id-token: write
9
+ contents: read
10
+
11
+ jobs:
12
+ check:
13
+ runs-on: ubuntu-latest
14
+ container: node:24-slim
15
+
16
+ steps:
17
+ - name: Checkout code
18
+ uses: actions/checkout@v4
19
+
20
+ - name: Install dependencies
21
+ run: npm ci
22
+
23
+ - name: Run Biome check
24
+ run: npm run check
25
+
26
+ test:
27
+ runs-on: ubuntu-latest
28
+ container: node:${{ matrix.node-version }}-slim
29
+
30
+ strategy:
31
+ matrix:
32
+ node-version: [16, 18, 20, 22, 24]
33
+
34
+ steps:
35
+ - name: Checkout code
36
+ uses: actions/checkout@v4
37
+
38
+ - name: Install dependencies
39
+ run: npm ci
40
+
41
+ - name: Run tests
42
+ run: npm test
43
+
44
+ audit:
45
+ runs-on: ubuntu-latest
46
+ container: node:24-slim
47
+
48
+ steps:
49
+ - name: Checkout code
50
+ uses: actions/checkout@v4
51
+
52
+ - name: Install dependencies
53
+ run: npm ci
54
+
55
+ - name: Run npm audit
56
+ run: npm audit --audit-level=high
57
+
58
+ publish:
59
+ runs-on: ubuntu-latest
60
+ container: node:24-slim
61
+ needs: [check, test, audit]
62
+ if: startsWith(github.ref, 'refs/tags/')
63
+
64
+ steps:
65
+ - name: Checkout code
66
+ uses: actions/checkout@v4
67
+
68
+ - name: Checkout code
69
+ uses: actions/setup-node@v4
70
+ with:
71
+ node-version: 24
72
+ registry-url: https://registry.npmjs.org/
73
+
74
+ - name: Install dependencies
75
+ run: npm ci
76
+
77
+ - name: Publish to npm
78
+ run: npm publish
package/AGENTS.md ADDED
@@ -0,0 +1,82 @@
1
+ # Agent Instructions
2
+
3
+ ## Project Overview
4
+
5
+ This is a CLI tool for creating SFCC (Salesforce Commerce Cloud) B2C migrations. It generates XML metadata files for custom objects, site preferences, and system object extensions.
6
+
7
+ ## Code Principles
8
+
9
+ ### DRY (Don't Repeat Yourself)
10
+
11
+ - Extract shared logic into `lib/` utilities
12
+ - Reuse XML generation functions from `lib/templates.js`
13
+ - Shared constants (attribute types, system objects) should be defined once
14
+
15
+ ### KISS (Keep It Simple, Stupid)
16
+
17
+ - Prefer simple, readable code over clever solutions
18
+ - Each function should do one thing well
19
+ - Avoid unnecessary abstractions
20
+ - Use clear, descriptive variable and function names
21
+
22
+ ### YAGNI (You Aren't Gonna Need It)
23
+
24
+ - Don't add features "just in case"
25
+ - Implement only what's needed for the current requirement
26
+ - Remove unused code rather than commenting it out
27
+
28
+ ### LoB (Locality of Behavior)
29
+
30
+ - Keep related code close together
31
+ - Command-specific logic stays in its command file
32
+ - Avoid spreading a single behavior across multiple files
33
+ - Prefer inline handlers over distant callbacks when reasonable
34
+
35
+ ### Functional Style
36
+
37
+ - Prefer pure functions without side effects
38
+ - Use `map`, `filter`, `reduce` over imperative loops
39
+ - Avoid mutating function arguments
40
+ - Return new objects/arrays instead of modifying existing ones
41
+ - Keep I/O (file operations, console output) at the edges
42
+
43
+ ## Project Structure
44
+
45
+ ```
46
+ ├── index.js # CLI entry point
47
+ ├── commands/ # Command handlers (one file per command)
48
+ │ ├── create-migration.js
49
+ │ ├── custom-object.js
50
+ │ ├── site-preference.js
51
+ │ └── system-object.js
52
+ └── lib/ # Shared utilities
53
+ ├── merge.js # XML merging logic
54
+ ├── templates.js # XML generation templates
55
+ └── utils.js # File system and naming utilities
56
+ ```
57
+
58
+ ## Coding Guidelines
59
+
60
+ - Use `const` by default, `let` only when reassignment is needed
61
+ - Use template literals for XML generation
62
+ - Handle errors with try/catch and provide helpful messages
63
+ - Use `chalk` for colored console output
64
+ - Use `inquirer` for interactive prompts
65
+ - Use `yargs` for CLI argument parsing
66
+
67
+ ## XML Generation
68
+
69
+ - Always use the `METADATA_NAMESPACE` constant
70
+ - Escape XML special characters with `escapeXml()`
71
+ - Generate well-formatted, indented XML
72
+ - Keep XML templates readable with multi-line template literals
73
+
74
+ ## Before Finishing
75
+
76
+ Always run the linter before committing or finishing work:
77
+
78
+ ```bash
79
+ npm run check
80
+ ```
81
+
82
+ Ensure there are no errors. Use `npm run check:write` to auto-fix issues when possible.