@specdest/devkit 0.4.19 → 0.4.20
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/README.md +105 -28
- package/dist/npm/cli.js +16 -26
- package/dist/npm/index.js +4 -1
- package/dist/npm/native/specdest-darwin-arm64 +0 -0
- package/dist/npm/native/specdest-darwin-x64 +0 -0
- package/dist/npm/native/specdest-linux-arm64 +0 -0
- package/dist/npm/native/specdest-linux-x64 +0 -0
- package/package.json +8 -5
- package/dist/npm/automation-policy.d.ts +0 -2
- package/dist/npm/automation-policy.js +0 -30
- package/dist/npm/canonical-project-operations.d.ts +0 -5
- package/dist/npm/canonical-project-operations.js +0 -5
- package/dist/npm/canonical-project.d.ts +0 -21
- package/dist/npm/canonical-project.js +0 -115
- package/dist/npm/catalog-snapshot.d.ts +0 -53
- package/dist/npm/catalog-snapshot.js +0 -35
- package/dist/npm/client-only-boundary.d.ts +0 -1
- package/dist/npm/client-only-boundary.js +0 -29
- package/dist/npm/commands.d.ts +0 -16
- package/dist/npm/commands.js +0 -194
- package/dist/npm/git-catalog.d.ts +0 -40
- package/dist/npm/git-catalog.js +0 -222
- package/dist/npm/github-doppler-secrets.d.ts +0 -8
- package/dist/npm/github-doppler-secrets.js +0 -156
- package/dist/npm/host-automation.d.ts +0 -9
- package/dist/npm/host-automation.js +0 -87
- package/dist/npm/installer-primitives.d.ts +0 -3
- package/dist/npm/installer-primitives.js +0 -50
- package/dist/npm/predefined-packages/abac.d.ts +0 -2
- package/dist/npm/predefined-packages/abac.js +0 -45
- package/dist/npm/predefined-packages/admin-ui-templates/AdminAccessAssignments.tsx.template +0 -67
- package/dist/npm/predefined-packages/admin-ui-templates/AdminConfirmDialog.tsx.template +0 -46
- package/dist/npm/predefined-packages/admin-ui-templates/AdminDataTable.tsx.template +0 -49
- package/dist/npm/predefined-packages/admin-ui-templates/AdminDetailLayout.tsx.template +0 -15
- package/dist/npm/predefined-packages/admin-ui-templates/AdminEmptyState.tsx.template +0 -17
- package/dist/npm/predefined-packages/admin-ui-templates/AdminFilterBar.tsx.template +0 -16
- package/dist/npm/predefined-packages/admin-ui-templates/AdminFormLayout.tsx.template +0 -19
- package/dist/npm/predefined-packages/admin-ui-templates/AdminMembershipManager.tsx.template +0 -56
- package/dist/npm/predefined-packages/admin-ui-templates/AdminPage.tsx.template +0 -19
- package/dist/npm/predefined-packages/admin-ui-templates/AdminPageHeader.tsx.template +0 -19
- package/dist/npm/predefined-packages/admin-ui-templates/AdminPagination.tsx.template +0 -20
- package/dist/npm/predefined-packages/admin-ui-templates/AdminPermissionMatrix.tsx.template +0 -54
- package/dist/npm/predefined-packages/admin-ui-templates/AdminRoleManager.tsx.template +0 -81
- package/dist/npm/predefined-packages/admin-ui-templates/AdminShell.tsx.template +0 -20
- package/dist/npm/predefined-packages/admin-ui-templates/AdminSidebar.tsx.template +0 -18
- package/dist/npm/predefined-packages/admin-ui-templates/AdminStatCard.tsx.template +0 -22
- package/dist/npm/predefined-packages/admin-ui.d.ts +0 -2
- package/dist/npm/predefined-packages/admin-ui.js +0 -83
- package/dist/npm/predefined-packages/auth-templates/README.md.template +0 -9
- package/dist/npm/predefined-packages/auth-templates/convex.ts.template +0 -18
- package/dist/npm/predefined-packages/auth-templates/identity.ts.template +0 -2
- package/dist/npm/predefined-packages/auth-templates/supabase.ts.template +0 -36
- package/dist/npm/predefined-packages/auth.d.ts +0 -2
- package/dist/npm/predefined-packages/auth.js +0 -36
- package/dist/npm/predefined-packages/convex.d.ts +0 -2
- package/dist/npm/predefined-packages/convex.js +0 -53
- package/dist/npm/predefined-packages/expo.d.ts +0 -2
- package/dist/npm/predefined-packages/expo.js +0 -88
- package/dist/npm/predefined-packages/firebase-hosting.d.ts +0 -2
- package/dist/npm/predefined-packages/firebase-hosting.js +0 -24
- package/dist/npm/predefined-packages/health.d.ts +0 -10
- package/dist/npm/predefined-packages/health.js +0 -52
- package/dist/npm/predefined-packages/husky.d.ts +0 -2
- package/dist/npm/predefined-packages/husky.js +0 -57
- package/dist/npm/predefined-packages/index.d.ts +0 -12
- package/dist/npm/predefined-packages/index.js +0 -97
- package/dist/npm/predefined-packages/install.d.ts +0 -19
- package/dist/npm/predefined-packages/install.js +0 -86
- package/dist/npm/predefined-packages/local-logging.d.ts +0 -2
- package/dist/npm/predefined-packages/local-logging.js +0 -17
- package/dist/npm/predefined-packages/logging.d.ts +0 -2
- package/dist/npm/predefined-packages/logging.js +0 -21
- package/dist/npm/predefined-packages/multi-tenancy.d.ts +0 -2
- package/dist/npm/predefined-packages/multi-tenancy.js +0 -37
- package/dist/npm/predefined-packages/nps.d.ts +0 -2
- package/dist/npm/predefined-packages/nps.js +0 -32
- package/dist/npm/predefined-packages/oxfmt.d.ts +0 -2
- package/dist/npm/predefined-packages/oxfmt.js +0 -22
- package/dist/npm/predefined-packages/oxlint.d.ts +0 -2
- package/dist/npm/predefined-packages/oxlint.js +0 -35
- package/dist/npm/predefined-packages/package-json.d.ts +0 -3
- package/dist/npm/predefined-packages/package-json.js +0 -61
- package/dist/npm/predefined-packages/payments.d.ts +0 -2
- package/dist/npm/predefined-packages/payments.js +0 -31
- package/dist/npm/predefined-packages/playwright.d.ts +0 -2
- package/dist/npm/predefined-packages/playwright.js +0 -35
- package/dist/npm/predefined-packages/project-signals.d.ts +0 -4
- package/dist/npm/predefined-packages/project-signals.js +0 -39
- package/dist/npm/predefined-packages/registry.d.ts +0 -3
- package/dist/npm/predefined-packages/registry.js +0 -65
- package/dist/npm/predefined-packages/resolver.d.ts +0 -8
- package/dist/npm/predefined-packages/resolver.js +0 -35
- package/dist/npm/predefined-packages/security-templates/README.md.template +0 -15
- package/dist/npm/predefined-packages/security-templates/convex-authorization.ts.template +0 -109
- package/dist/npm/predefined-packages/security-templates/permissions.ts.template +0 -40
- package/dist/npm/predefined-packages/security-templates/supabase-admin-rpc.sql.template +0 -54
- package/dist/npm/predefined-packages/security-templates/supabase-authorization.sql.template +0 -138
- package/dist/npm/predefined-packages/security-templates/supabase-posts-example.sql.template +0 -39
- package/dist/npm/predefined-packages/sentry.d.ts +0 -2
- package/dist/npm/predefined-packages/sentry.js +0 -29
- package/dist/npm/predefined-packages/shadcn.d.ts +0 -2
- package/dist/npm/predefined-packages/shadcn.js +0 -23
- package/dist/npm/predefined-packages/storybook.d.ts +0 -2
- package/dist/npm/predefined-packages/storybook.js +0 -25
- package/dist/npm/predefined-packages/stryker.d.ts +0 -2
- package/dist/npm/predefined-packages/stryker.js +0 -48
- package/dist/npm/predefined-packages/supabase.d.ts +0 -2
- package/dist/npm/predefined-packages/supabase.js +0 -355
- package/dist/npm/predefined-packages/tailwind.d.ts +0 -2
- package/dist/npm/predefined-packages/tailwind.js +0 -18
- package/dist/npm/predefined-packages/tanstack-form.d.ts +0 -2
- package/dist/npm/predefined-packages/tanstack-form.js +0 -19
- package/dist/npm/predefined-packages/tanstack-query.d.ts +0 -2
- package/dist/npm/predefined-packages/tanstack-query.js +0 -15
- package/dist/npm/predefined-packages/tanstack-router.d.ts +0 -2
- package/dist/npm/predefined-packages/tanstack-router.js +0 -18
- package/dist/npm/predefined-packages/tenant-templates/README.md.template +0 -11
- package/dist/npm/predefined-packages/tenant-templates/tenant-context.ts.template +0 -22
- package/dist/npm/predefined-packages/types.d.ts +0 -38
- package/dist/npm/predefined-packages/types.js +0 -1
- package/dist/npm/predefined-packages/vite.d.ts +0 -2
- package/dist/npm/predefined-packages/vite.js +0 -127
- package/dist/npm/predefined-packages/vitest.d.ts +0 -2
- package/dist/npm/predefined-packages/vitest.js +0 -20
- package/dist/npm/predefined-packages/zod.d.ts +0 -2
- package/dist/npm/predefined-packages/zod.js +0 -18
- package/dist/npm/project-check.d.ts +0 -37
- package/dist/npm/project-check.js +0 -231
- package/dist/npm/project-context.d.ts +0 -52
- package/dist/npm/project-context.js +0 -211
- package/dist/npm/project-install-guard.d.ts +0 -2
- package/dist/npm/project-install-guard.js +0 -51
- package/dist/npm/project-rules.d.ts +0 -25
- package/dist/npm/project-rules.js +0 -106
- package/dist/npm/project-runtime.d.ts +0 -21
- package/dist/npm/project-runtime.js +0 -41
- package/dist/npm/project-status.d.ts +0 -32
- package/dist/npm/project-status.js +0 -70
- package/dist/npm/project-sync.d.ts +0 -7
- package/dist/npm/project-sync.js +0 -143
- package/dist/npm/remote-installer.d.ts +0 -35
- package/dist/npm/remote-installer.js +0 -351
- package/dist/npm/rule-id-migrations.d.ts +0 -6
- package/dist/npm/rule-id-migrations.js +0 -19
- package/dist/npm/slack.d.ts +0 -16
- package/dist/npm/slack.js +0 -135
- package/dist/npm/snapshot/config.d.ts +0 -10
- package/dist/npm/snapshot/config.js +0 -24
- package/dist/npm/snapshot/policy.d.ts +0 -1
- package/dist/npm/snapshot/policy.js +0 -64
- package/dist/npm/snapshot/restore.d.ts +0 -10
- package/dist/npm/snapshot/restore.js +0 -19
- package/dist/npm/snapshot/sql.d.ts +0 -2
- package/dist/npm/snapshot/sql.js +0 -113
- package/dist/npm/snapshot/storage.d.ts +0 -8
- package/dist/npm/snapshot/storage.js +0 -70
- package/dist/npm/snapshot/verify.d.ts +0 -11
- package/dist/npm/snapshot/verify.js +0 -13
- package/dist/npm/snapshot-cli.d.ts +0 -6
- package/dist/npm/snapshot-cli.js +0 -45
- package/dist/npm/state.d.ts +0 -14
- package/dist/npm/state.js +0 -269
- package/dist/npm/supabase-local.d.ts +0 -2
- package/dist/npm/supabase-local.js +0 -63
package/README.md
CHANGED
|
@@ -2,9 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
`@specdest/devkit` is the canonical Devkit CLI for Specdest repositories.
|
|
4
4
|
|
|
5
|
-
The CLI
|
|
5
|
+
The CLI uses a native Rust binary (`Cargo.toml`, `rust/`, `tests/`). The npm launcher and source launcher execute Rust without a TypeScript fallback. The existing JavaScript API, catalog tooling and remote installer remain available for compatibility. Canonical rule checkers under `modules/**` remain strict TypeScript executed with Node 24+.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### Native Rust CLI
|
|
8
|
+
|
|
9
|
+
The planned post-migration executable rename and local-source workflow are tracked in [CLI cutover requirements](docs/operations/post-rust-cli-cutover.md).
|
|
10
|
+
|
|
11
|
+
The cross-repository [engineering architecture and efficiency program](docs/engineering-efficiency/README.md) tracks measurement, lifecycle architecture, implementation tasks and pilot adoption.
|
|
12
|
+
|
|
13
|
+
Build and test the native Rust CLI (`target/release/specdest`):
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
cargo build --release
|
|
17
|
+
cargo test
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Commands with arguments, options or nested commands display contextual help when invoked without arguments, with `--help`, or with `-h`, in both TTY and CI. Commands without options execute normally. Use `--run` for default rule and flow operations. Interactive operation-specific prompts remain TTY-only.
|
|
21
|
+
|
|
22
|
+
The npm package bundles the native CLI for Linux x64, macOS arm64 and macOS x64, plus the compatibility JavaScript API. Canonical rules stay in the private Devkit GitHub repository and are fetched with normal Git/SSH transport into a local machine cache when needed. Rule changes therefore do not require an npm release.
|
|
8
23
|
|
|
9
24
|
The root package API is intentionally small: `runCli`, `COMMAND_NAMES`, `createCanonicalSource`, `createFlowCommandHandler`. Installer, state, sync, and canonical orchestration modules are internal implementation details.
|
|
10
25
|
|
|
@@ -13,34 +28,77 @@ The root package API is intentionally small: `runCli`, `COMMAND_NAMES`, `createC
|
|
|
13
28
|
## Commands
|
|
14
29
|
|
|
15
30
|
```bash
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
# rule — canonical rules, syncing, checking, and AI guidance
|
|
32
|
+
specdest rule status [--run | --refresh] [--json]
|
|
33
|
+
specdest rule sync --run # or --local
|
|
34
|
+
specdest rule check --run
|
|
35
|
+
specdest rule check [--local] [--refresh] [--json] [--details]
|
|
36
|
+
specdest rule check --staged
|
|
37
|
+
specdest rule check --files src/path/file.ts
|
|
38
|
+
specdest rule list [--run] [--id <rule>] [--category <cat>] [--failed] [--json]
|
|
39
|
+
specdest rule ai-instruction
|
|
40
|
+
|
|
41
|
+
# package — predefined package and stack bundle installation
|
|
42
|
+
specdest package add [package] [--local]
|
|
43
|
+
specdest package add-group [group] [--local]
|
|
44
|
+
|
|
45
|
+
# flow — local resumable development flow state
|
|
46
|
+
specdest flow status [--run | --json]
|
|
47
|
+
specdest flow start --mode feature --goal "Add password reset" --task auth-reset
|
|
48
|
+
specdest flow checkpoint --phase implement
|
|
49
|
+
specdest flow verify --run
|
|
50
|
+
specdest flow complete --run
|
|
51
|
+
|
|
52
|
+
# skill — Base-managed custom coding-agent skills
|
|
53
|
+
specdest skill list --scope global [--json]
|
|
54
|
+
specdest skill status --scope <global|project|all> [--agent <codex|antigravity|all>] [--json]
|
|
55
|
+
specdest skill sync --scope <global|project|all> [--agent <codex|antigravity|all>] [--dry-run] [--json]
|
|
56
|
+
|
|
57
|
+
# host — host cleanup, local Supabase, and device/browser automation
|
|
58
|
+
specdest host cleanup <mac|ubuntu> [check|usage|--clean-with-confirm] [options]
|
|
59
|
+
specdest host supabase <status|start|stop|result ID>
|
|
60
|
+
specdest host device <subcommand> [args...]
|
|
61
|
+
specdest host browser <subcommand> [args...]
|
|
62
|
+
specdest host jev-browser <subcommand> [args...]
|
|
63
|
+
|
|
64
|
+
# ops — diagnostics, secrets, snapshots, and Slack artifact sharing
|
|
65
|
+
specdest ops doctor
|
|
66
|
+
specdest ops secrets github <check|push> [options]
|
|
67
|
+
specdest ops snapshot verify <directory>
|
|
68
|
+
specdest ops expo ota publish --environment production [--current | --all-runtimes | --target <platform:runtime>...]
|
|
69
|
+
specdest ops expo native build --environment production --platform <ios|android>
|
|
70
|
+
specdest ops slack send [--message <text>] [--thread <ts>] <files...>
|
|
30
71
|
```
|
|
31
72
|
|
|
32
|
-
- `status`
|
|
33
|
-
-
|
|
34
|
-
- `
|
|
35
|
-
- `
|
|
36
|
-
- `
|
|
37
|
-
- `
|
|
38
|
-
- `
|
|
73
|
+
- AI host gateway: `host-cli devkit-safe-cleanup mac start/status/stop/check/usage` (and alias `host-cli safe-cleanup mac ...`) are the only authorized read-only operations (install via Controller's `scripts/internal/install-devkit-safe-cleanup-macos.sh`). Agents must return the local `specdest host cleanup mac --clean-with-confirm` command to the user, never perform cleanup remotely.
|
|
74
|
+
- Full operation matrix, tiered candidates, protected data, AI gateway, and installation: [Host safe cleanup](docs/operations/mac-safe-cleanup.md).
|
|
75
|
+
- `host cleanup <mac|ubuntu>` is a host-only storage audit and selective cleanup utility, read-only when invoked with `check --run` or explicit scan options. Options include `--project-paths <p1,p2>` (defaults to `~/workplace`), `--stale-days <days>` (default `14`), `--min-size-mb <mb>` (default `150`), `--select <selection>`, `--exclude <ids>`, `--yes`, `--non-interactive`, and `--json` (in `check` mode). `--clean-with-confirm` previews numbered cleanup candidates grouped into Tier A (Safe Defaults — regenerable caches, stale Codex temp installers >24h verified via `lsof`, and `pnpm store prune`, `npm cache clean --force`, `brew cleanup --prune=all`, and Docker build/image prunes), Tier B (Stale Project Artifacts — inactive `node_modules`, `target`, `.next`, `.turbo`, `dist`, `build`, broken worktree dependencies, temporary `devkit-acceptance-*` directories, and `worktrees/.pnpm-store`), and Tier C (Large Archives >= `--min-size-mb`), then opens an interactive fuzzy-searchable multi-select TUI (or accepts `--select` / `--exclude` / `--yes` for non-interactive usage). Chrome profiles/cookies/logins, active Codex runtime, Git repository source code, Android emulator data, iOS simulator runtimes, OrbStack volumes, and Docker volumes are never automatically removed. Run directly on the host, not from the Local Coder container.
|
|
76
|
+
- `rule status` reads the cached canonical catalog and reports applicable/current/missing/outdated rules plus registered predefined packages. Use `--refresh` to refresh the catalog from GitHub and `--json` for machine-readable output.
|
|
77
|
+
- `package add <package>` applies or adopts a predefined package recipe. Package recipes use only three relationship primitives: `requires`, `conflicts`, and environment-selected `variants`. `requires` is evaluated against packages registered in Devkit state; conflicts and variant selection also consider packages physically detected in the project. `rule status` and `ops doctor` report stale package state, while `rule sync`, `rule check`, and `rule list` refuse to run against invalid package metadata. The supported foundational packages are `vite`, `expo`, `supabase`, and `convex`. Additional predefined packages are `auth`, `multi-tenancy`, `abac`, `sentry`, `logging`, `payments`, `shadcn`, `tanstack-router`, `tanstack-query`, `tanstack-form`, `storybook`, `playwright`, `vitest`, `local-logging`, `firebase-hosting`, `zod`, `tailwind`, `husky`, `nps`, `oxlint`, `oxfmt`, and `stryker`. Create-or-adopt recipes include the foundations (`vite`, `expo`, `supabase`, `convex`) and deterministic self-contained tooling (`zod`, `vitest`, `oxlint`, `oxfmt`, `husky`, `nps`, `tanstack-form`, `playwright`, `stryker`). They create minimal local dependencies/configuration when absent, then run `pnpm install`; when an integration already exists they adopt it without rewriting project-owned application files. Runtime-wired or product-specific recipes remain adoption-only until Devkit has a deterministic, product-neutral installation contract. Recipes record the recipe version separately from any detected dependency version in `.spd/installed.json`; Devkit does not invent product-specific auth, tenancy, authorization, logging, or payment architecture. Generated/adopted application code remains project-owned. Package lifecycle is deliberately fire-and-forget: there is no package `remove` or `upgrade` command. Developers remove packages manually; to update a recipe, re-run `package add <package>`. Re-adding applies only the current recipe and does not remove files/settings that existed only in an older recipe. See [`docs/package-model.md`](docs/package-model.md). Supabase creation also scaffolds the canonical guarded declarative production-release workflow; registering Supabase activates the corresponding database rule/checker for ongoing enforcement. When Devkit-created foundation packages resolve a supported stack, required canonical setup packages are installed automatically (for example Oxlint/Husky for React stack gates and NPS for Supabase database commands); adopted stacks remain non-invasive and report missing setup through canonical checks.
|
|
78
|
+
- `package add admin-ui` adopts an established shared admin page system or creates project-owned shadcn-based admin source components without overwriting existing files. See [`docs/admin-ui.md`](docs/admin-ui.md).
|
|
79
|
+
- `rule sync` refreshes the canonical catalog, downloads only missing rule-cache entries, installs missing applicable rules, and updates outdated ones.
|
|
80
|
+
- `rule check` executes each distinct canonical checker implementation once from the local Devkit cache and projects that result onto every rule backed by that checker. Default output stays concise. Use `--details` to print normalized checker diagnostics (including file/line/column when the checker emits them), and `--json` for structured results with `diagnostics[]`. Use `--refresh` to refresh the canonical catalog/checker cache first without reconciling project files. `--staged` resolves target paths/content from the Git index; `--files` supplies explicit project-relative paths. Repository-scoped checkers still run globally. Targeted checks are ephemeral and do not update `.spd/state.json`; only a full check records canonical project status.
|
|
81
|
+
- `rule list` loads AI-facing guidance without dumping the whole catalog. Use `--id <rule>`, `--category <category>`, `--failed`, or `--json`; with no selector it returns only rules marked `ai.load = "always"`.
|
|
82
|
+
- `ops doctor` reports project-stack/cache setup problems.
|
|
39
83
|
- `flow` manages local, resumable development state under `.spd/`. Canonical workflows are fixed: Feature/Fix use `plan → implement → verify → complete`; Inspect uses `plan → complete`. Use `--task <id>` when multiple tasks exist and `--context-file flow-notes/<task>.md` only when rich working context is needed. `flow verify` runs the repository's existing `.husky/pre-push` gate when present, otherwise its package `check` script; completion requires a successful, still-current verification. Runtime state is local-only and removed on completion.
|
|
40
84
|
|
|
85
|
+
## Expo release operations (Rust CLI)
|
|
86
|
+
|
|
87
|
+
Projects declare the Expo project ID, runtime file and environment-specific release hooks in `release/expo.json`. OTA uses the project’s local EAS CLI and prepared credentials. Open the multi-select with no target flags, or pass `--current`, `--all-runtimes`, or repeatable `--target` for automation. Confirm native compatibility before selecting older runtimes. The default Android runtime alignment gate applies when the selected targets include the configured Android default; explicitly selected historical Android runtimes discovered from embedded builds or declared in the environment’s `historicalTargets` (for locally built binaries) do not require default alignment. Both workflows support `--dry-run`. Native builds operate on prepared versions and verify the artifact before reporting success.
|
|
88
|
+
|
|
89
|
+
OTA publishes use one project-provided release number. An incomplete release can resume with `--resume <number>` from the same checkout. Keep `tmp/devkit/expo/` ignored by Git. It contains the local release journal used to verify existing updates and retry outstanding steps. Release hooks are executable project code. Run publishing commands from a trusted checkout.
|
|
90
|
+
|
|
91
|
+
## Custom agent skills
|
|
92
|
+
|
|
93
|
+
`specdest skill` synchronizes Base-owned custom skills for Codex and Antigravity, separately from canonical engineering rules. See [custom coding-agent skills](docs/architecture/custom-agent-skills.md) for configuration, scope, authentication, and ownership protection. Source implemented; live Base activation and agent discovery remain unverified.
|
|
94
|
+
|
|
95
|
+
## Agent workflow ownership
|
|
96
|
+
|
|
97
|
+
Devkit `flow` is a **local, resumable development workflow**, not Base AFC or Base DevFlow. Base AFC currently runs 24 ordered gates with Pi at Gate 21; reusable feature/bug/research templates and an iterative Jev action loop are proposed **Base-owned** additions, not implemented Devkit features. Controller provides MCP discovery and dispatch. See [agent orchestration boundaries](docs/architecture/agent-orchestration-boundary.md).
|
|
98
|
+
|
|
41
99
|
## AI usage
|
|
42
100
|
|
|
43
|
-
`
|
|
101
|
+
`specdest rule ai-instruction` prints the development bootstrap for coding agents, including Controller/project instruction discovery, intent-based Flow usage, focused Devkit rule loading, implementation, verification, and commit guidance. Agents performing standalone local development should inspect DevKit Flow state before repository work, while semantic task classification and worktree choice remain agent-policy decisions. For AFC-managed work, use Devkit rules/checks as required evidence; do not assume Base AFC should independently start a second DevKit Flow lifecycle for the same task. DevKit Flow owns persisted task state, phase transitions, verification, and completion; DevKit rules/checks own deterministic repository enforcement. Agent-specific policy such as ChatGPT's `@specdest-development` skill belongs outside DevKit rather than being duplicated in the CLI.
|
|
44
102
|
|
|
45
103
|
The CLI resolves a project stack from supported Expo/Vite + Convex/Supabase package dependencies when possible; otherwise it uses the single committed requested `stack-*` root in `.spd/installed.json`. Explicit predefined-package registrations are committed as requested `kind: "package"` entries with separate `recipeVersion` and `detectedVersion` fields, and are preserved by canonical rule sync. Foundational adapters such as Vite use the same recipe mechanism as feature packages; `role` metadata distinguishes frontend/backend/foundation intent without a separate installer architecture. Canonical rules may declare `requiredPackages` (for example `vite` or `supabase`) instead of enumerating every compatible stack; legacy stack applicability remains supported during migration. Optional `.spd/rules.json` adds the project type/capabilities plus explicit rule includes/exclusions; every exclusion requires a reason. `.spd/installed.json` and `.spd/state.json` remain the committed project status used by the Base rules matrix.
|
|
46
104
|
|
|
@@ -51,9 +109,9 @@ See [`docs/operations.md`](docs/operations.md) for cache, dashboard, CI, and rel
|
|
|
51
109
|
## Canonical cache runtime
|
|
52
110
|
|
|
53
111
|
Canonical authoring lives under `modules/**`. The CLI refreshes a single-branch bare Git source and hydrates required modules from the same catalog revision into the local Devkit cache and materializes their `.agents/skills/**` target layout **inside the cache** so checker-relative imports keep working without copying canonical skills/checkers into project repositories. `catalog/**` is compatibility/test data, not a rule-authoring source.
|
|
54
|
-
|
|
112
|
+
Native CLI project state is owned by `rust/state.rs`; the compatibility API retains `src/state.ts`, which reads, validates, formats, and atomically writes `.spd/installed.json` and `.spd/state.json`. Sync/install/check code must use the state module of its respective runtime rather than implementing state IO independently.
|
|
55
113
|
|
|
56
|
-
|
|
114
|
+
Native CLI project applicability is owned by `rust/project_context.rs`; the compatibility API retains `src/project-context.ts`, which detects the stack, reads `.spd/rules.json`, resolves project type/capabilities, validates overrides, and selects applicable canonical rules.
|
|
57
115
|
|
|
58
116
|
Project operations are split by behavior: `project-status.ts`, `project-sync.ts`, `project-check.ts`, and `project-rules.ts`; `commands.ts` is only the CLI adapter, while `canonical-project-operations.ts` remains a compatibility re-export.
|
|
59
117
|
|
|
@@ -67,8 +125,8 @@ Screenshot capture remains owned by each project (for example `agent-device` or
|
|
|
67
125
|
`agent-browser`). Devkit only uploads existing files:
|
|
68
126
|
|
|
69
127
|
```sh
|
|
70
|
-
specdest slack send --message 'UI review' screenshots/*.png
|
|
71
|
-
specdest slack send --thread 1234567890.123456 screenshots/new.png
|
|
128
|
+
specdest ops slack send --message 'UI review' screenshots/*.png
|
|
129
|
+
specdest ops slack send --thread 1234567890.123456 screenshots/new.png
|
|
72
130
|
```
|
|
73
131
|
|
|
74
132
|
When no `SLACK_CHANNEL_ID` is set in the environment or project `.env.e2e.local`, commit a channel in `.spd/config.json`:
|
|
@@ -85,3 +143,22 @@ message and uploads the files as threaded attachments unless `--thread` is
|
|
|
85
143
|
provided. Missing configuration fails explicitly, with no channel prompt. See [`docs/slack-artifacts.md`](docs/slack-artifacts.md) for ownership boundaries, configuration, and retry semantics.
|
|
86
144
|
|
|
87
145
|
Snapshot migration design: [docs/supabase-masked-snapshot-migration.md](docs/supabase-masked-snapshot-migration.md). Production export remains disabled pending independent masking approval.
|
|
146
|
+
|
|
147
|
+
### Opinionated package groups
|
|
148
|
+
|
|
149
|
+
Run `specdest package add-group` to list the available bundles:
|
|
150
|
+
|
|
151
|
+
- `package add-group frontend-vite`: Vite, Zod, Tailwind, TanStack Router, Form, shadcn and `components-web`. The starter home links to an account-validation form, component showcase and URL-controlled dialog.
|
|
152
|
+
- `package add-group frontend-expo`: Expo, Zod, Expo Router, Form and `components-native`. The starter home links to native form, component showcase and modal screens.
|
|
153
|
+
- `package add-group backend-supabase`: Supabase, Zod, authentication, authorization and tenancy; adds the example `demo_tasks` CRUD page to an installed starter frontend. Vite also gets TanStack Query and admin UI.
|
|
154
|
+
- `package add-group backend-convex`: Convex, Zod, authentication, authorization and tenancy.
|
|
155
|
+
|
|
156
|
+
`package add components-web` and `package add components-native` can be invoked independently after their frontend/router prerequisites. The web recipe installs a curated set of official shadcn registry primitives, plus a reusable password field, debounced async autocomplete, pagination and search/filter controls. New scaffold pages are responsive; existing project-owned files are preserved where the recipe can identify the original placeholder.
|
|
157
|
+
|
|
158
|
+
For Supabase CRUD, configure the corresponding Vite or Expo public Supabase environment variables, sign in with a test user, and apply `supabase/schemas/040_demo_tasks.sql` using the project’s normal schema workflow. RLS restricts task access to the authenticated owner. The native demo uses a non-persistent authentication session. The example form does not create accounts. The groups are starter scaffolds, not complete production applications.
|
|
159
|
+
|
|
160
|
+
**Generated admin workspace (Vite + Supabase):** Open `/admin/users` for the tenant-scoped user directory and `/admin/users/$userId` to edit a display name. The landing-page header shows **Admin** only when an authenticated call to a tenant's `admin_list_users` RPC succeeds; hiding the link is not a substitute for backend authorization. The workspace uses the shared shadcn sidebar/cards, a compact company selector, search, and pagination over the first 100 users. Before expecting data, apply and review the generated `015_app_tenancy.sql` and `030_app_admin_users.sql` definitions, sign in, and provision a verified tenant membership and `access:manage` grants. The page explicitly reports missing RPCs, memberships, or permissions instead of displaying fake users. See [admin UI setup](docs/admin-ui.md) and generated `docs/security/admin-users.md`.
|
|
161
|
+
|
|
162
|
+
**Authentication:** The default Supabase web login offers email/password, signup, and password reset only. A Google OAuth helper is available but no Google button is shown until the project explicitly configures a Google provider and adds its UI.
|
|
163
|
+
|
|
164
|
+
**Re-running groups:** `package add-group frontend-vite` can migrate exact known, unchanged legacy shadcn files from hard-coded colors to semantic CSS-variable tokens. The admin backend group can also migrate known, unchanged Devkit admin pages to the responsive workspace layout. Customized files are preserved; changes to existing custom routing and auth setups remain the application's responsibility. No arbitrary project UI is overwritten.
|
package/dist/npm/cli.js
CHANGED
|
@@ -1,28 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { runGitHubDopplerSecrets } from "./github-doppler-secrets.js";
|
|
9
|
-
import { assertStandaloneDevkit } from "./project-install-guard.js";
|
|
10
|
-
try {
|
|
11
|
-
assertStandaloneDevkit();
|
|
12
|
-
const exitCode = await runCli(process.argv.slice(2), process, {
|
|
13
|
-
...createCanonicalCommandHandlers(),
|
|
14
|
-
flow: createFlowCommandHandler(),
|
|
15
|
-
supabase: async (args) => runSupabaseLocal(args),
|
|
16
|
-
slack: async (args) => sendSlackFiles(args),
|
|
17
|
-
device: async (args) => runHostAutomation('device', args),
|
|
18
|
-
browser: async (args) => runHostAutomation('browser', args),
|
|
19
|
-
'jev-browser': async (args) => runHostAutomation('jev-browser', args),
|
|
20
|
-
snapshot: runSnapshot,
|
|
21
|
-
secrets: runGitHubDopplerSecrets,
|
|
22
|
-
});
|
|
23
|
-
process.exitCode = exitCode;
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
27
|
-
process.exitCode = 1;
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
const platform = `${process.platform}-${process.arch}`;
|
|
5
|
+
if (!['linux-x64', 'linux-arm64', 'darwin-arm64', 'darwin-x64'].includes(platform)) {
|
|
6
|
+
console.error(`specdest: unsupported platform ${platform}`);
|
|
7
|
+
process.exit(1);
|
|
28
8
|
}
|
|
9
|
+
const child = spawn(fileURLToPath(new URL(`./native/specdest-${platform}`, import.meta.url)), process.argv.slice(2), { stdio: 'inherit' });
|
|
10
|
+
const signals = ['SIGINT', 'SIGTERM', 'SIGHUP'];
|
|
11
|
+
const handlers = signals.map(signal => () => child.kill(signal));
|
|
12
|
+
signals.forEach((signal, i) => process.on(signal, handlers[i]));
|
|
13
|
+
child.on('error', error => { console.error(`specdest: ${error.message}`); process.exitCode = 1; });
|
|
14
|
+
child.on('close', (code, signal) => {
|
|
15
|
+
signals.forEach((s, i) => process.removeListener(s, handlers[i]));
|
|
16
|
+
if (signal) process.kill(process.pid, signal);
|
|
17
|
+
else if (process.exitCode !== 1) process.exitCode = code ?? 1;
|
|
18
|
+
});
|
package/dist/npm/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { createFlowCommandHandler } from "./flow.js";
|
|
|
3
3
|
export const COMMAND_NAMES = [
|
|
4
4
|
'status',
|
|
5
5
|
'add',
|
|
6
|
+
'add-group',
|
|
6
7
|
'sync',
|
|
7
8
|
'check',
|
|
8
9
|
'rules',
|
|
@@ -15,9 +16,11 @@ export const COMMAND_NAMES = [
|
|
|
15
16
|
'browser',
|
|
16
17
|
'jev-browser',
|
|
17
18
|
'snapshot',
|
|
19
|
+
'safe-cleanup',
|
|
18
20
|
'secrets',
|
|
21
|
+
'skill',
|
|
19
22
|
];
|
|
20
|
-
const HELP = `Usage: specdest <command> [options]\n\nCommands:\n status [--refresh] [--json] Show canonical applicability/install status\n add
|
|
23
|
+
const HELP = `Usage: specdest <command> [options]\n\nCommands:\n status [--refresh] [--json] Show canonical applicability/install status\n add [package] List available packages or adopt/install one\n add-group [group] [--local] List groups or configure using local working-tree rules\n sync [--local] Sync canonical rules (or local Devkit working-tree rules)\n check [--local] [--refresh] [--json] [--details] [--staged | --files <path...>] Run canonical checks\n rules [options] Load applicable rule guidance for AI/task context\n ai-instruction Print the minimal AI bootstrap instruction\n doctor Diagnose project/cache setup\n flow <command> Manage local resumable development flow state\n supabase <status|start|stop> Local Supabase through restricted Controller\n slack send <files...> Upload files to configured Slack channel\n device <args...> Forward to Controller agent-device\n browser <args...> Forward to Controller agent-browser\n jev-browser <args...> Forward to Controller jev-browser (if configured)\n snapshot verify <directory> Verify an offline snapshot bundle\n safe-cleanup <mac|ubuntu> [check|usage|--clean-with-confirm] [options] Host storage audit and selective cleanup\n skill <list|status|sync> Manage custom agent skills\n secrets github <check|push> Compare presence or explicitly sync Doppler secrets to GitHub\n`;
|
|
21
24
|
export async function runCli(argv, io = process, handlers = {}) {
|
|
22
25
|
const [command, ...args] = argv;
|
|
23
26
|
if (!command || command === 'help' || command === '--help' || command === '-h') {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@specdest/devkit",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"specdest": "dist/npm/cli.js"
|
|
@@ -37,16 +37,19 @@
|
|
|
37
37
|
"rules:audit": "node scripts/generate-rule-audit.mjs --check",
|
|
38
38
|
"rules:audit:write": "node scripts/generate-rule-audit.mjs",
|
|
39
39
|
"typecheck:checkers": "node scripts/typecheck-checkers.mjs",
|
|
40
|
-
"build": "node -e \"require('node:fs').rmSync('dist/npm',{recursive:true,force:true})\" && tsc -p tsconfig.build.json
|
|
41
|
-
"prepack": "pnpm run build",
|
|
40
|
+
"build": "node -e \"require('node:fs').rmSync('dist/npm',{recursive:true,force:true})\" && tsc -p tsconfig.build.json",
|
|
41
|
+
"prepack": "pnpm run build && node scripts/stage-native-package.mjs",
|
|
42
42
|
"format:check": "oxfmt --check src/*.ts",
|
|
43
43
|
"format": "oxfmt --write src/*.ts"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^24.0.0",
|
|
47
|
-
"typescript": "^6.0.0",
|
|
48
|
-
"oxlint": "1.82.0",
|
|
49
47
|
"oxfmt": "0.54.0",
|
|
48
|
+
"oxlint": "1.95.0",
|
|
49
|
+
"tsrs": "7.1.0-beta.tsrs5",
|
|
50
|
+
"typescript": "^6.0.0"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
50
53
|
"zod": "^4.6.4"
|
|
51
54
|
}
|
|
52
55
|
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { readFileSync, existsSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
const FORBIDDEN = /(?:\b(?:pnpm\s+exec|npx|npm\s+exec|yarn\s+exec|bunx)\s+(?:agent-device|agent-browser|jev-browser)\b|\bhost-cli\s+(?:agent-device|agent-browser|jev-browser)\b|\b(?:SPECDEST_AGENT_DEVICE_BIN|node_modules\/\.bin\/(?:agent-device|agent-browser|jev-browser))\b)/u;
|
|
4
|
-
const DIRECT = new Set(['agent-device', 'agent-browser', 'jev-browser']);
|
|
5
|
-
/** Check project-owned entrypoints; Controller and Devkit are intentionally exempt. */
|
|
6
|
-
export function automationPolicyFindings(root, files) {
|
|
7
|
-
const findings = [];
|
|
8
|
-
const manifestPath = join(root, 'package.json');
|
|
9
|
-
if (existsSync(manifestPath)) {
|
|
10
|
-
const manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
|
|
11
|
-
for (const field of ['dependencies', 'devDependencies', 'optionalDependencies']) {
|
|
12
|
-
for (const name of Object.keys(manifest[field] ?? {})) {
|
|
13
|
-
if (DIRECT.has(name))
|
|
14
|
-
findings.push(`package.json: ${name} must be accessed via Devkit`);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
for (const file of files) {
|
|
19
|
-
if (!/^(?:scripts\/.*\.(?:sh|js|cjs|mjs|ts|py)|package-scripts\.yml)$/u.test(file))
|
|
20
|
-
continue;
|
|
21
|
-
if (/(?:^|\/)(?:test[^/]*|[^/]*\.test\.[^/]*)$/u.test(file))
|
|
22
|
-
continue;
|
|
23
|
-
const full = join(root, file);
|
|
24
|
-
if (!existsSync(full))
|
|
25
|
-
continue;
|
|
26
|
-
if (FORBIDDEN.test(readFileSync(full, 'utf8')))
|
|
27
|
-
findings.push(`${file}: invoke through specdest device/browser instead of direct host tools`);
|
|
28
|
-
}
|
|
29
|
-
return findings;
|
|
30
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { createCanonicalCommandHandlers } from './commands.ts';
|
|
2
|
-
export { canonicalCheck } from './project-check.ts';
|
|
3
|
-
export { aiInstructionText, canonicalRules } from './project-rules.ts';
|
|
4
|
-
export { canonicalDoctor, canonicalStatus } from './project-status.ts';
|
|
5
|
-
export { canonicalSync } from './project-sync.ts';
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { createCanonicalCommandHandlers } from "./commands.js";
|
|
2
|
-
export { canonicalCheck } from "./project-check.js";
|
|
3
|
-
export { aiInstructionText, canonicalRules } from "./project-rules.js";
|
|
4
|
-
export { canonicalDoctor, canonicalStatus } from "./project-status.js";
|
|
5
|
-
export { canonicalSync } from "./project-sync.js";
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export declare function prepareCachedManifest(entry: any, ruleRoot: any, canonicalCheckRoot: any, checkerRuntimeRoot?: any): Promise<{
|
|
2
|
-
manifest: {
|
|
3
|
-
check?: import("./schemas.ts").JsonRecord;
|
|
4
|
-
copies: any[];
|
|
5
|
-
markdownSections: import("./schemas.ts").JsonRecord[];
|
|
6
|
-
revision?: any;
|
|
7
|
-
contentHash?: any;
|
|
8
|
-
kind: any;
|
|
9
|
-
version: any;
|
|
10
|
-
id: string;
|
|
11
|
-
operations?: import("./schemas.ts").JsonRecord[];
|
|
12
|
-
checker?: import("./schemas.ts").JsonRecord;
|
|
13
|
-
};
|
|
14
|
-
checkerPath: string | null;
|
|
15
|
-
checkerArgs: any;
|
|
16
|
-
checkerKey: string | null;
|
|
17
|
-
targeting: {
|
|
18
|
-
scope: any;
|
|
19
|
-
};
|
|
20
|
-
execution: any;
|
|
21
|
-
}>;
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { cp, mkdir, readFile, rm } from 'node:fs/promises';
|
|
2
|
-
import { basename, dirname, join } from 'node:path';
|
|
3
|
-
import { CanonicalManifestSchema, parseWithSchema } from "./schemas.js";
|
|
4
|
-
function isSkillTarget(copy) {
|
|
5
|
-
return String(copy?.target ?? copy?.path ?? '').startsWith('.agents/skills/');
|
|
6
|
-
}
|
|
7
|
-
function isProjectScaffold(copy) {
|
|
8
|
-
return copy?.mode === 'scaffold' || copy?.mode === 'create-only';
|
|
9
|
-
}
|
|
10
|
-
function keepProjectCopy(copy) {
|
|
11
|
-
return !isSkillTarget(copy) || isProjectScaffold(copy);
|
|
12
|
-
}
|
|
13
|
-
async function materializeCopies(manifest, sourceRoot, runtimeRoot) {
|
|
14
|
-
for (const copy of manifest?.copies ?? []) {
|
|
15
|
-
if (!isSkillTarget(copy) || isProjectScaffold(copy))
|
|
16
|
-
continue;
|
|
17
|
-
const source = join(sourceRoot, String(copy.source ?? ''));
|
|
18
|
-
const target = join(runtimeRoot, String(copy.target ?? copy.path ?? ''));
|
|
19
|
-
await mkdir(dirname(target), { recursive: true });
|
|
20
|
-
await cp(source, target, {
|
|
21
|
-
recursive: copy.type === 'directory' || copy.directory === true,
|
|
22
|
-
force: true,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
async function readManifest(root) {
|
|
27
|
-
return parseWithSchema(CanonicalManifestSchema, JSON.parse(await readFile(join(root, 'manifest.json'), 'utf8')), `canonical manifest at ${root}`);
|
|
28
|
-
}
|
|
29
|
-
async function cacheProjectCopies(copies, sourceRoot, ruleRoot, label) {
|
|
30
|
-
const result = [];
|
|
31
|
-
for (const copy of copies.filter(keepProjectCopy)) {
|
|
32
|
-
if (sourceRoot === ruleRoot) {
|
|
33
|
-
result.push(copy);
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
const source = String(copy.source ?? '');
|
|
37
|
-
const cachedSource = join('.project-scaffolds', label, source);
|
|
38
|
-
const target = join(ruleRoot, cachedSource);
|
|
39
|
-
await mkdir(dirname(target), { recursive: true });
|
|
40
|
-
await cp(join(sourceRoot, source), target, {
|
|
41
|
-
recursive: copy.type === 'directory' || copy.directory === true,
|
|
42
|
-
force: true,
|
|
43
|
-
});
|
|
44
|
-
result.push({ ...copy, source: cachedSource });
|
|
45
|
-
}
|
|
46
|
-
return result;
|
|
47
|
-
}
|
|
48
|
-
function checkerPolicy(manifest) {
|
|
49
|
-
const scope = manifest?.targeting?.scope ?? 'repository';
|
|
50
|
-
if (!['file', 'related', 'repository'].includes(scope))
|
|
51
|
-
throw new Error(`Invalid checker targeting scope: ${scope}`);
|
|
52
|
-
const execution = manifest?.execution ?? 'automatic';
|
|
53
|
-
if (!['automatic', 'manual'].includes(execution))
|
|
54
|
-
throw new Error(`Invalid checker execution class: ${execution}`);
|
|
55
|
-
return { targeting: { scope }, execution };
|
|
56
|
-
}
|
|
57
|
-
function runtimeChecker(manifest, runtimeRoot) {
|
|
58
|
-
if (manifest?.check?.command?.[0] !== 'node')
|
|
59
|
-
return null;
|
|
60
|
-
const target = String(manifest.check.command[1] ?? '');
|
|
61
|
-
if (!target.startsWith('.agents/skills/'))
|
|
62
|
-
return null;
|
|
63
|
-
return {
|
|
64
|
-
path: join(runtimeRoot, target),
|
|
65
|
-
args: manifest.check.command.slice(2).map(String),
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
export async function prepareCachedManifest(entry, ruleRoot, canonicalCheckRoot, checkerRuntimeRoot = null) {
|
|
69
|
-
const raw = await readManifest(ruleRoot);
|
|
70
|
-
const checkerKey = raw.checker?.path
|
|
71
|
-
? `canonical:${String(raw.checker.path)}`
|
|
72
|
-
: raw.check?.command
|
|
73
|
-
? `command:${JSON.stringify(raw.check.command)}`
|
|
74
|
-
: null;
|
|
75
|
-
const runtimeRoot = join(ruleRoot, '.runtime');
|
|
76
|
-
await rm(runtimeRoot, { recursive: true, force: true });
|
|
77
|
-
await mkdir(runtimeRoot, { recursive: true });
|
|
78
|
-
if (checkerRuntimeRoot) {
|
|
79
|
-
await materializeCopies(await readManifest(checkerRuntimeRoot), checkerRuntimeRoot, runtimeRoot);
|
|
80
|
-
}
|
|
81
|
-
await materializeCopies(raw, ruleRoot, runtimeRoot);
|
|
82
|
-
const copies = await cacheProjectCopies(raw.copies ?? [], ruleRoot, ruleRoot, entry.id);
|
|
83
|
-
let checker = runtimeChecker(raw, runtimeRoot);
|
|
84
|
-
let { targeting, execution } = checkerPolicy(raw);
|
|
85
|
-
if (!checker && raw.checker?.path && canonicalCheckRoot) {
|
|
86
|
-
const relative = String(raw.checker.path).replace(/^canonical-check\//u, '');
|
|
87
|
-
const implementationRoot = dirname(join(canonicalCheckRoot, relative));
|
|
88
|
-
const implementationManifest = await readManifest(implementationRoot);
|
|
89
|
-
({ targeting, execution } = checkerPolicy(implementationManifest));
|
|
90
|
-
await materializeCopies(implementationManifest, implementationRoot, runtimeRoot);
|
|
91
|
-
copies.push(...(await cacheProjectCopies(implementationManifest.copies ?? [], implementationRoot, ruleRoot, basename(implementationRoot))));
|
|
92
|
-
checker = runtimeChecker(implementationManifest, runtimeRoot);
|
|
93
|
-
}
|
|
94
|
-
const markdownSections = (raw.markdownSections ?? []).filter((section) => !String(section?.body ?? section?.content ?? '').includes('.agents/skills/'));
|
|
95
|
-
const manifest = {
|
|
96
|
-
...raw,
|
|
97
|
-
kind: raw.kind ?? entry.kind ?? 'rule',
|
|
98
|
-
version: entry.version ?? raw.version,
|
|
99
|
-
...(entry.contentHash ? { contentHash: entry.contentHash } : {}),
|
|
100
|
-
...(entry.revision ? { revision: entry.revision } : {}),
|
|
101
|
-
copies: [
|
|
102
|
-
...new Map(copies.map((copy) => [String(copy.target ?? copy.path ?? copy.source), copy])).values(),
|
|
103
|
-
],
|
|
104
|
-
markdownSections,
|
|
105
|
-
...(checker ? { check: { command: ['specdest-cache', entry.id] } } : {}),
|
|
106
|
-
};
|
|
107
|
-
return {
|
|
108
|
-
manifest,
|
|
109
|
-
checkerPath: checker?.path ?? null,
|
|
110
|
-
checkerArgs: checker?.args ?? [],
|
|
111
|
-
checkerKey,
|
|
112
|
-
targeting,
|
|
113
|
-
execution,
|
|
114
|
-
};
|
|
115
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
export declare function buildCatalogSnapshot(): Promise<{
|
|
2
|
-
package: {
|
|
3
|
-
name: string | undefined;
|
|
4
|
-
version: string | undefined;
|
|
5
|
-
};
|
|
6
|
-
entries: {
|
|
7
|
-
source: string;
|
|
8
|
-
id: string;
|
|
9
|
-
kind: "rule" | "module";
|
|
10
|
-
version: string;
|
|
11
|
-
name: string;
|
|
12
|
-
content: string;
|
|
13
|
-
order: number;
|
|
14
|
-
revision: string;
|
|
15
|
-
contentHash: string;
|
|
16
|
-
summary?: string;
|
|
17
|
-
category?: string;
|
|
18
|
-
scope?: string;
|
|
19
|
-
labels?: string[];
|
|
20
|
-
enforcement?: string;
|
|
21
|
-
legacyInstalledIds?: string[];
|
|
22
|
-
applicableStacks?: string[];
|
|
23
|
-
requiredPackages?: string[];
|
|
24
|
-
requiredCapabilities?: string[];
|
|
25
|
-
composedOf?: string[];
|
|
26
|
-
notApplicableRuleIds?: string[];
|
|
27
|
-
projectProfiles?: {
|
|
28
|
-
[x: string]: {
|
|
29
|
-
ruleIds: string[];
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
ai?: unknown;
|
|
33
|
-
verification?: unknown;
|
|
34
|
-
}[];
|
|
35
|
-
predefinedPackages: {
|
|
36
|
-
id: string;
|
|
37
|
-
recipeVersion: string;
|
|
38
|
-
role: string;
|
|
39
|
-
requires: string[];
|
|
40
|
-
conflicts: string[];
|
|
41
|
-
variants: {
|
|
42
|
-
id: string;
|
|
43
|
-
when: string[];
|
|
44
|
-
}[];
|
|
45
|
-
setupRequirements: {
|
|
46
|
-
kind: "package";
|
|
47
|
-
packageId: string;
|
|
48
|
-
required: boolean;
|
|
49
|
-
when?: "git";
|
|
50
|
-
}[];
|
|
51
|
-
}[];
|
|
52
|
-
schemaVersion: number;
|
|
53
|
-
}>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import { fileURLToPath } from 'node:url';
|
|
3
|
-
import { buildGitCatalog } from "./git-catalog.js";
|
|
4
|
-
import { listPackageRecipes } from "./predefined-packages/registry.js";
|
|
5
|
-
import { PackageJsonSchema, parseWithSchema } from "./schemas.js";
|
|
6
|
-
const MODULES_ROOT = fileURLToPath(new URL('../modules/', import.meta.url));
|
|
7
|
-
export async function buildCatalogSnapshot() {
|
|
8
|
-
const packageJson = parseWithSchema(PackageJsonSchema, JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8')), 'DevKit package.json');
|
|
9
|
-
const catalog = await buildGitCatalog({
|
|
10
|
-
modulesRoot: MODULES_ROOT,
|
|
11
|
-
repositoryRevision: packageJson.version,
|
|
12
|
-
});
|
|
13
|
-
return {
|
|
14
|
-
...catalog,
|
|
15
|
-
package: { name: packageJson.name, version: packageJson.version },
|
|
16
|
-
entries: catalog.entries
|
|
17
|
-
.map((entry) => ({ ...entry, source: '@specdest/devkit' }))
|
|
18
|
-
.sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0)),
|
|
19
|
-
predefinedPackages: listPackageRecipes()
|
|
20
|
-
.map((recipe) => ({
|
|
21
|
-
id: recipe.id,
|
|
22
|
-
recipeVersion: recipe.recipeVersion,
|
|
23
|
-
role: recipe.role,
|
|
24
|
-
requires: [...(recipe.requires ?? [])].sort(),
|
|
25
|
-
conflicts: [...(recipe.conflicts ?? [])].sort(),
|
|
26
|
-
variants: (recipe.variants ?? [])
|
|
27
|
-
.map((variant) => ({ id: variant.id, when: [...variant.when].sort() }))
|
|
28
|
-
.sort((a, b) => a.id.localeCompare(b.id)),
|
|
29
|
-
setupRequirements: (recipe.setupRequirements ?? [])
|
|
30
|
-
.map((requirement) => ({ ...requirement }))
|
|
31
|
-
.sort((a, b) => a.packageId.localeCompare(b.packageId)),
|
|
32
|
-
}))
|
|
33
|
-
.sort((a, b) => a.id.localeCompare(b.id)),
|
|
34
|
-
};
|
|
35
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function clientOnlyBoundaryViolations(projectRoot: string): Promise<string[]>;
|