Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased

- **Refresh keeps your map when Git cannot read a repository:** the refresh stops and names the problem before it can mistake missing files for deletions and remove their descriptions.

## 0.11.0 (2026-11-16)

- **Serverless Framework endpoints are on the map:** a backend whose endpoints are declared in `serverless.yml` rather than in code showed none, so the website's requests to it weren't connected and Health skipped its sign-in check. Endpoints now come from each function's `http` and `httpApi` events (`path` and `method`, `any` and `*`, and the short `http: GET /orders` form) in `serverless.yml`, `serverless-*.yml` and `serverless_*.yml`, including function lists split across files included with `${file(./functions.yml)}`. Each endpoint sits in the file its `handler:` names (`src/orders.create` is `create` in `src/orders.ts`), followed through a file that re-exports it, or into another file's function when the handler only passes the request on to it (`(event) => withEvent(event, options, orders.create)`). Health counts an `authorizer`, `private: true` (an API key) or a sign-in check handed to the wrapper as protecting an endpoint, and still reads the handler for a check of its own. CloudFormation tags (`!Ref`, `!GetAtt`, `!Sub`), `${opt:…}` and `${self:…}` variables and anchors are read without trouble, and the scan summary lists schedules, queues, streams and other background functions for a worker node. Sample configs in test folders add no endpoints. Reported and fixed by @ShehanEk in #131 and #132.
Expand Down
4 changes: 2 additions & 2 deletions docs/unattended.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ The NEXT codes are stable, so a program can act on them:
| `review_structure` | a large change; check the summaries and flows | |
| `recent_work` | always last: mark recent work | |
| `first_map` | there's no map yet; make one | |
| `fix_scan` | the scan stopped (unattended mode only); see `errors` | |
| `fix_scan` | the scan stopped before changing the map; see `errors` | |
| `fix_plan`, `blueprint` | blueprints only (see [How it works](how-it-works.md#blueprints)) | |

### recent.mjs: `floorplan/recent-result@1`
Expand All @@ -132,7 +132,7 @@ The NEXT codes are stable, so a program can act on them:
| `scan.mjs` | 1 only on a crash; git problems are reported, not failed | also 1 when git can't list a repo, or no files are found |
| `build.mjs` | 1 on errors, or no scan or architecture.json | the same |
| `describe.mjs` | 1 without a map; 0 when there's nothing to describe | the same |
| `refresh.mjs` | 0, even with no map or a failed build (the NEXT list says what to do) | 1 when there's no map, the scan fails or the build fails |
| `refresh.mjs` | 1 when the scan fails. A missing map or failed code-map build still exits 0 (the NEXT list says what to do) | 1 when there's no map, the scan fails or the build fails |
| `recent.mjs` | 1 without a map | the same |
| `status.mjs` | always 0 | the same |

Expand Down
10 changes: 6 additions & 4 deletions skills/floorplan/scripts/refresh.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
// usage: node refresh.mjs [root] [--from-code] [--json] [--unattended]
//
// --json prints one JSON object (floorplan/refresh-result@1): the change counts, the build's own --json
// result, and NEXT as items with stable codes. In unattended mode (FLOORPLAN_UNATTENDED=1 or --unattended)
// it exits 1 when there's no map, the scan fails, or the build fails; otherwise those exit 0 as before.
// result, and NEXT as items with stable codes. A failed scan exits 1 without
// changing the map. In unattended mode (FLOORPLAN_UNATTENDED=1 or --unattended)
// a missing map or failed code-map build also exits 1.

import fs from 'node:fs';
import path from 'node:path';
Expand Down Expand Up @@ -64,9 +65,10 @@ if (old.meta?.blueprint && !args['from-code']) {
// ---------- 1. re-scan (no tokens) ----------
let scanResult = null;
try {
scanResult = JSON.parse(execFileSync(node, [path.join(HERE, 'scan.mjs'), root, '--json'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'inherit'] }));
// Refresh treats missing files as deletions. A partial scan cannot safely replace the
// previous inventory, so use the scanner's strict mode even in an interactive session.
scanResult = JSON.parse(execFileSync(node, [path.join(HERE, 'scan.mjs'), root, '--json', '--unattended'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'inherit'] }));
} catch (e) {
// only unattended mode fails a scan on purpose (a repo git can't list, or no files at all)
let failed = null;
try { failed = JSON.parse(String(e.stdout || '')); } catch {}
if (!failed) throw e;
Expand Down
23 changes: 23 additions & 0 deletions tests/unattended.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,29 @@ test('a refresh whose scan fails exits non-zero in unattended mode, with NEXT fi
} finally { cleanup(p); }
});

test('refresh preserves the map and descriptions when Git cannot list one repository', () => {
const p = shopApp();
try {
const map = path.join(p, 'floorplan');
const description = path.join(map, 'descriptions', 'shop-web.json');
fs.mkdirSync(path.dirname(description), { recursive: true });
writeJson(description, { files: { 'shop-web/src/App.jsx': { name: 'Shop page', description: 'Shows products.' } } });
run('scan.mjs', p); run('build.mjs', p, '--no-claude-md');
const saved = [description, path.join(map, 'graph.json'), path.join(map, '.cache', 'scan.json')];
const contents = saved.map((name) => fs.readFileSync(name, 'utf8'));
breakRepo(path.join(p, 'shop-web'));

const plain = exec('refresh.mjs', p);
assert.equal(plain.code, 1);
assert.match(plain.out, /shop-web adds no files to the map/);
const result = exec('refresh.mjs', p, ['--json']);
assert.equal(result.code, 1);
assert.equal(result.json.ok, false);
assert.deepEqual(result.json.next.map((n) => n.code), ['fix_scan']);
assert.deepEqual(saved.map((name) => fs.readFileSync(name, 'utf8')), contents);
} finally { cleanup(p); }
});

// ---------- exit codes: unattended mode is reliable, everyone else sees no change ----------
test('refresh exit codes: unattended mode fails on no map and on a failed build; default mode still exits 0', () => {
const p = shopApp();
Expand Down