@smapiot/pilet-template-angular 1.0.18 → 1.0.19-beta.9a34a2e

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/lib/index.js CHANGED
@@ -1614,7 +1614,7 @@ function getStandardPackageJson(cliVersion, ngVersion, majorNgVersion) {
1614
1614
  // src/index.ts
1615
1615
  var root = (0, import_path.resolve)(__dirname, "..");
1616
1616
  var index_default = (0, import_template_utils.createPiletTemplateFactory)(root, (projectRoot, args, details) => {
1617
- const { sourceName } = args;
1617
+ const { sourceName, agents } = args;
1618
1618
  const piralInstance = (0, import_template_utils.getPiralInstance)(projectRoot, sourceName);
1619
1619
  if (typeof args.standalone === "undefined") {
1620
1620
  args.standalone = detectMode(piralInstance);
@@ -1694,6 +1694,13 @@ var index_default = (0, import_template_utils.createPiletTemplateFactory)(root,
1694
1694
  target: "<root>/tsconfig.json"
1695
1695
  }
1696
1696
  ];
1697
+ if (agents) {
1698
+ templates.push({
1699
+ languages: ["js", "ts"],
1700
+ name: "AGENTS.md",
1701
+ target: "<root>/AGENTS.md"
1702
+ });
1703
+ }
1697
1704
  if (args.ngStandalone) {
1698
1705
  templates.push({
1699
1706
  languages: ["ts"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smapiot/pilet-template-angular",
3
- "version": "1.0.18",
3
+ "version": "1.0.19-beta.9a34a2e",
4
4
  "description": "Official scaffolding template for pilets: 'angular'.",
5
5
  "keywords": [
6
6
  "piral-cli",
@@ -31,6 +31,11 @@
31
31
  "description": "Defines the (major) version of Angular to use in case of a standalone pilet.",
32
32
  "default": 20,
33
33
  "type": "number"
34
+ },
35
+ "agents": {
36
+ "description": "Generate an AGENTS.md rules file for AI assistants.",
37
+ "default": true,
38
+ "type": "boolean"
34
39
  }
35
40
  },
36
41
  "author": "smapiot",
@@ -59,7 +64,7 @@
59
64
  "test": "echo \"Error: run tests from root\" && exit 1"
60
65
  },
61
66
  "devDependencies": {
62
- "@smapiot/template-utils": "^1.0.18"
67
+ "@smapiot/template-utils": "1.0.19-beta.9a34a2e"
63
68
  },
64
- "gitHead": "76894038c678cedede53e5e69fe81d9579330973"
69
+ "gitHead": "9a34a2ee4fe3fbaa52ac34fc9b8bee63b795eae8"
65
70
  }
package/src/index.ts CHANGED
@@ -15,10 +15,11 @@ interface AngularPiletArgs {
15
15
  ngVersion: number;
16
16
  ngStandalone: boolean;
17
17
  withZone?: boolean;
18
+ agents?: boolean;
18
19
  }
19
20
 
20
21
  export default createPiletTemplateFactory<AngularPiletArgs>(root, (projectRoot, args, details) => {
21
- const { sourceName } = args;
22
+ const { sourceName, agents } = args;
22
23
  const piralInstance = getPiralInstance(projectRoot, sourceName);
23
24
 
24
25
  if (typeof args.standalone === 'undefined') {
@@ -109,6 +110,14 @@ export default createPiletTemplateFactory<AngularPiletArgs>(root, (projectRoot,
109
110
  },
110
111
  ];
111
112
 
113
+ if (agents) {
114
+ templates.push({
115
+ languages: ['js', 'ts'],
116
+ name: 'AGENTS.md',
117
+ target: '<root>/AGENTS.md',
118
+ });
119
+ }
120
+
112
121
  if (args.ngStandalone) {
113
122
  templates.push({
114
123
  languages: ['ts'],
@@ -0,0 +1,39 @@
1
+ # Micro Frontend project rules (for AI assistants)
2
+
3
+ > Generated when this pilet was scaffolded. Most assistants read AGENTS.md
4
+ > (Cursor/Claude), .cursorrules, or .github/copilot-instructions.md — copy or
5
+ > symlink as needed. Keep this in sync with the app shell's real capabilities.
6
+
7
+ This repository is the pilet **<%- piletName %>**, built with Piral (React micro
8
+ frontends). It uses Angular to declare and expose components and primarely targets
9
+ the app shell **<%- sourceName %>**.
10
+
11
+ ## Contract
12
+
13
+ - App shell package: `<%- sourceName %>`. Import the Pilet API as:
14
+ `import type { PiletApi } from '<%- sourceName %>'`.
15
+ - Installed Pilet API plugins — only these methods exist: <%- (typeof plugins !== 'undefined' && plugins && plugins.length) ? plugins.join(', ') : 'see the app shell package.json' %>.
16
+ - Centrally shared externals (provided by the shell — never bundle, never import a
17
+ different version): `react`, `react-dom`, and anything else the shell declares in
18
+ its `importmap` (e.g. `react-router-dom`, a design system).
19
+ - Extension slots: list the slot names (and their `params`) your app shell and other pilets expose.
20
+
21
+ ## Conventions
22
+
23
+ - A pilet's only entry is a single exported `setup(api: PiletApi)` function.
24
+ Register pages, menus, and extensions there.
25
+ - Only call Pilet API methods provided by the plugins listed above. Do not invent methods.
26
+ - Never install `piral-cli` globally; never use `pilet new` or `piral new`. Run the
27
+ CLI via npm scripts or `npx` (`npx pilet debug | build | publish`).
28
+ - Share libraries via the `importmap` in `package.json`; treat the externals above
29
+ as provided by the shell.
30
+ - Pilets must not import each other. Compose UI via extension slots; share data via
31
+ events or the shared data store.
32
+ - Registrations are cleaned up automatically on unload/hot-reload; only call
33
+ `unregister*` for genuinely dynamic cases.
34
+ - Prefer `piral-core` over `piral` for long-lived shells (same API, explicit plugins).
35
+ - Write tests with Vitest by unit-testing `setup()` with a mock `PiletApi`.
36
+
37
+ ## Docs
38
+
39
+ - Piral documentation: https://docs.piral.io