@jskit-ai/agent-docs 0.1.389 → 0.1.390

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 (31) hide show
  1. package/guide/agent/app-extras/realtime.md +12 -8
  2. package/guide/agent/app-setup/initial-scaffolding.md +17 -0
  3. package/guide/agent/framework/test-pass.md +3 -2
  4. package/guide/agent/framework/typed-features.md +120 -2
  5. package/package.json +1 -1
  6. package/patterns/feature-package/example/booking-engine/package.json +1 -1
  7. package/patterns/minimal-foundation/example/package.json +4 -4
  8. package/patterns/shell-foundation/example/package.json +5 -5
  9. package/patterns/shell-foundation/example/packages/main/package.json +1 -1
  10. package/reference/autogen/PATTERN_INDEX.md +40 -40
  11. package/reference/autogen/packages/assistant-core.md +4 -2
  12. package/reference/autogen/packages/kernel.md +5 -0
  13. package/reference/autogen/packages/realtime.md +2 -0
  14. package/reference/autogen/tooling/jskit-catalog.md +34 -1
  15. package/skills/jskit/references/pattern-index.md +40 -40
  16. package/skills/jskit/references/patterns/app/minimal-foundation/example/package.json +4 -4
  17. package/skills/jskit/references/patterns/app/shell-foundation/example/package.json +5 -5
  18. package/skills/jskit/references/patterns/app/shell-foundation/example/packages/main/package.json +1 -1
  19. package/skills/jskit/references/patterns/auth/accounts-hub/example/package.json +3 -3
  20. package/skills/jskit/references/patterns/auth/oidc-sign-in/example/package.json +2 -2
  21. package/skills/jskit/references/patterns/auth/supabase-auth/example/package.json +1 -1
  22. package/skills/jskit/references/patterns/connectors/calendar-cli/example/package.json +5 -5
  23. package/skills/jskit/references/patterns/crud/crud-feature-package/example/packages/books/package.json +3 -3
  24. package/skills/jskit/references/patterns/database/mysql-application/example/package.json +2 -2
  25. package/skills/jskit/references/patterns/database/postgres-application/example/package.json +2 -2
  26. package/skills/jskit/references/patterns/realtime/realtime-application/example/package.json +2 -2
  27. package/skills/jskit/references/patterns/server/feature-package/example/booking-engine/package.json +1 -1
  28. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users/package.json +3 -3
  29. package/skills/jskit/references/patterns/users/user-administration-server/example/packages/users-workspace/package.json +6 -6
  30. package/skills/jskit/references/test-pass.md +3 -2
  31. package/skills/jskit/references/typed-features.md +120 -2
@@ -1429,6 +1429,115 @@ export default [
1429
1429
 
1430
1430
  Every finding ends with a link to the section of this page that explains it.
1431
1431
 
1432
+ ### A check runs once per tree
1433
+
1434
+ A check that passed on the exact tree is never run again, and `jskit verify`
1435
+ keeps that rule itself. `npm run verify` is `jskit verify`, and package.json
1436
+ declares what it runs:
1437
+
1438
+ ```json
1439
+ {
1440
+ "scripts": {
1441
+ "verify": "jskit verify",
1442
+ "lint": "eslint .",
1443
+ "test": "jskit test --databases",
1444
+ "test:client": "vitest run"
1445
+ },
1446
+ "jskitVerify": {
1447
+ "parts": ["lint", "test", { "script": "test:client", "env": { "APP_BUILT": "1" } }],
1448
+ "settings": ["APP_ENV", "MYAPP_*"],
1449
+ "checkouts": "tooling/verify-checkouts.mjs"
1450
+ }
1451
+ }
1452
+ ```
1453
+
1454
+ - `parts` are the npm scripts of the whole check, run in order as
1455
+ `npm run <part>`; the first that fails ends the run with its exit status. A
1456
+ part given as an object gets its `env` settings, and only it does.
1457
+ - `settings` names the settings whose values the check depends on, a trailing
1458
+ `*` taking every name it starts. A value that names a folder in a Git
1459
+ checkout counts as that checkout's tree, one that names a file as its
1460
+ contents, any other as its digest: the record never holds a value.
1461
+ - `checkouts` names a module of the app whose default export,
1462
+ `({ projectRoot, env }) => ({ "<name>": "<folder>" })`, returns the other
1463
+ checkouts the check uses (another repository its tests run, a source checkout
1464
+ it composes), by the rule the app itself finds them with.
1465
+
1466
+ A whole run that passes records exactly what it checked in
1467
+ `node_modules/.cache/jskit/verify-passes/`: the project's tree (the tree of
1468
+ `HEAD`, so a rebase or an empty commit keeps it), each named checkout's tree,
1469
+ the installed dependencies of the project and of each checkout (every file's
1470
+ path, size and modification time under `node_modules`, so an `npm ci` or a
1471
+ package laid over by hand is another input), the declared settings, Node's
1472
+ version and the parts. The next `jskit verify` with the same inputs prints the
1473
+ record and runs nothing:
1474
+
1475
+ ```text
1476
+ jskit verify: it passed on this exact tree at 2026-12-01T10:00:00.000Z on desktop (the project 36545a948a1b, tree f14b03f42888; public 6ffe6eb08fc3; Node v26.5.0): not run again. Its record is node_modules/.cache/jskit/verify-passes/<key>.json; remove it to run the check again.
1477
+ ```
1478
+
1479
+ It runs the whole check and records nothing when it can't tell its inputs: a
1480
+ checkout with uncommitted changes or untracked files, a setting naming a folder
1481
+ outside Git or one Git ignores, a named checkout that is missing, or a
1482
+ `checkouts` module that fails. It records nothing for a part that fails, a run
1483
+ that is interrupted, or a tree or input that changed while it ran. Words after
1484
+ `npm run verify --` go to the last part (`npm run verify -- tests/x.test.js`):
1485
+ such a run checks part of the suite, so it neither reads nor writes a pass. A
1486
+ fresh `npm ci` empties the records; each machine keeps its own.
1487
+
1488
+ A CI run installs everything afresh, so its record is an artifact GitHub keeps,
1489
+ named for the project's tree and the commits of the other repositories the run
1490
+ checks out. `jskit verify-pass` is the run's first step: it names the pass,
1491
+ asks GitHub whether an artifact of that name is kept, and writes `name` and
1492
+ `reuse` to the step's outputs. It runs before `npm ci`, with the version of
1493
+ `@jskit-ai/jskit-catalog` the lock pins:
1494
+
1495
+ ```yaml
1496
+ jobs:
1497
+ pass:
1498
+ runs-on: ubuntu-latest
1499
+ permissions:
1500
+ contents: read
1501
+ actions: read
1502
+ outputs:
1503
+ other: ${{ steps.pass.outputs.other }}
1504
+ name: ${{ steps.pass.outputs.name }}
1505
+ reuse: ${{ steps.pass.outputs.reuse }}
1506
+ steps:
1507
+ - uses: actions/checkout@v7
1508
+ - uses: actions/setup-node@v7
1509
+ with:
1510
+ node-version: 26
1511
+ - id: pass
1512
+ env:
1513
+ GITHUB_TOKEN: ${{ github.token }}
1514
+ run: |
1515
+ other="$(git ls-remote --exit-code https://github.com/owner/other refs/heads/main | cut -f1)"
1516
+ echo "other=$other" >> "$GITHUB_OUTPUT"
1517
+ catalog="$(node -p "require('./package-lock.json').packages['node_modules/@jskit-ai/jskit-catalog'].version")"
1518
+ npx --yes --package="@jskit-ai/jskit-catalog@$catalog" jskit verify-pass --commit "other=$other"
1519
+ verify:
1520
+ needs: pass
1521
+ if: needs.pass.outputs.reuse != 'true'
1522
+ # ...checks out owner/other at ${{ needs.pass.outputs.other }}, then npm ci and npm run verify
1523
+ record:
1524
+ needs: [pass, verify]
1525
+ if: needs.verify.result == 'success'
1526
+ runs-on: ubuntu-latest
1527
+ steps:
1528
+ - run: echo "$GITHUB_SHA" > "$RUNNER_TEMP/pass.txt"
1529
+ - uses: actions/upload-artifact@v7
1530
+ with:
1531
+ name: ${{ needs.pass.outputs.name }}
1532
+ path: ${{ runner.temp }}/pass.txt
1533
+ retention-days: 90
1534
+ ```
1535
+
1536
+ A run whose tree and commits passed then runs nothing, and its log names the
1537
+ run that passed; delete the artifact to verify them again. A failed or
1538
+ cancelled run records nothing, so the next one verifies. Without a token to
1539
+ read the artifacts, or when GitHub refuses, the run verifies.
1540
+
1432
1541
  ### Lint rules
1433
1542
 
1434
1543
  | Rule | Reports | Section |
@@ -1500,7 +1609,7 @@ JavaScript, is read.
1500
1609
 
1501
1610
  | Rule | Reports | Fix |
1502
1611
  | --- | --- | --- |
1503
- | `test/fixed-sleep` | in a test file, `page.waitForTimeout(…)`, a `new Promise` that resolves on `setTimeout(…, <ms>)`, or an awaited `setTimeout`, `sleep`, `delay`, `pause` (its own or an object's, such as `timers.setTimeout(…)`) or `wait` (its own or node's `scheduler.wait(…)`) of a number of milliseconds | wait for the condition: a web-first assertion (`await expect(locator).toBeVisible()`), `expect.poll()`, the event itself, or a fake clock (`mock.timers`, `vi.useFakeTimers()`, `page.clock`) |
1612
+ | `test/fixed-sleep` | in a test file, `page.waitForTimeout(…)`, a `new Promise` that resolves on `setTimeout(…, <ms>)`, or an awaited `setTimeout`, `sleep`, `delay`, `pause` (its own or an object's, such as `timers.setTimeout(…)`) or `wait` (its own or node's `scheduler.wait(…)`) whose delay is a number of milliseconds or computed: arithmetic (`5 * 1000`), the file's constants (`SETTLE_MS`), a variable, a call or an object's value (`timings.settle`) | wait for the condition: a web-first assertion (`await expect(locator).toBeVisible()`), `expect.poll()`, the event itself, or a fake clock (`mock.timers`, `vi.useFakeTimers()`, `page.clock`) |
1504
1613
  | `test/fixed-database-name` | a test script that sets `TEST_DB_NAME`, `BROWSER_TEST_DB_NAME` or `DB_NAME`; a test file or runner config that falls back to or assigns a name for one (`process.env.TEST_DB_NAME \|\| "shop_test"`), outside a thrown error's message; a runner config that names one (`DB_NAME: "shop_e2e"`) | drop the name: the run's test-only env file or the host names the database, `jskit test --databases` gives each test file its own copy of `TEST_DB_NAME`, and `browserTestConfig()`'s `prepare` module derives each worker's from `BROWSER_TEST_DB_NAME` |
1505
1614
  | `test/test-database-is-app-database` | a CI workflow whose `TEST_DB_NAME` or `BROWSER_TEST_DB_NAME` is its `DB_NAME`, by value or as an `env.DB_NAME` expression | give it a name of its own, such as `<DB_NAME>_test`: a test run replaces its test databases from the snapshot, and JSKIT refuses to run one on `DB_NAME` |
1506
1615
  | `test/generated-into-src` | a `dts` path under `src/` in the root `vite.config.*`, such as vue-router's `src/typed-router.d.ts` or a components declaration file | write it outside `src`, such as `dts: "types/typed-router.d.ts"`, and move the file and its `.gitignore` line: a file written into `src` while the frontend builds keeps the browser tests from reusing that build (`not kept for reuse, as src changed while it ran`) |
@@ -1508,7 +1617,16 @@ JavaScript, is read.
1508
1617
  `test/fixed-sleep` reports a wait that stands in for a condition, not every
1509
1618
  timer. It does not report:
1510
1619
 
1511
- - a 0 ms timer, which yields a turn;
1620
+ - a delay that comes to 0 (`0`, `NONE * 10` with `const NONE = 0`), which
1621
+ yields a turn, and a string, which is no delay;
1622
+ - a delay that reads a parameter of a function around the wait, such as
1623
+ `ms` in `const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms))`:
1624
+ the helper waits as long as its callers ask, and theirs are reported when
1625
+ it is named `sleep`, `delay`, `pause` or `wait` (`await pause(200)`); a
1626
+ helper named otherwise is not read;
1627
+ - an own `wait(…)` whose delay does not come to a number, such as
1628
+ `wait("accept", intervene)` or `wait(event.type)`: an own `wait` is often
1629
+ a helper that waits for an event;
1512
1630
  - a timer that is an element of `Promise.race([…])`, which bounds the wait
1513
1631
  for something else;
1514
1632
  - a poll's interval: a wait in a loop that re-reads its condition each round,