@jimhoyd/urlcode 0.5.0 → 0.5.6

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 (67) hide show
  1. package/.claude/skills/urlcode-authoring/SKILL.md +1 -1
  2. package/.claude/skills/urlcode-operations/SKILL.md +1 -1
  3. package/README.md +13 -16
  4. package/dist/BUILD-MANIFEST.json +21 -18
  5. package/dist/agents-guide.js +1 -1
  6. package/dist/authoring.js +50 -9
  7. package/dist/capabilities.js +1 -1
  8. package/dist/cli.js +20 -7
  9. package/dist/ecosystem-cli.js +6 -0
  10. package/dist/explain-cli.js +1 -1
  11. package/dist/explain.js +2 -2
  12. package/dist/extension-artifacts.js +10 -23
  13. package/dist/extension-bundles.js +8 -16
  14. package/dist/extension-transport.js +41 -0
  15. package/dist/feature-plan.js +99 -0
  16. package/dist/index.js +2 -2
  17. package/dist/mcp.js +6 -2
  18. package/dist/policies/agents.js +1 -1
  19. package/dist/policies/security.js +1 -1
  20. package/dist/policies.js +1 -1
  21. package/dist/review.js +206 -0
  22. package/dist/router.js +15 -2
  23. package/dist/scripts/operational-drills.js +1 -1
  24. package/dist/tooling.js +4 -0
  25. package/dist/types/authoring.d.ts +2 -0
  26. package/dist/types/explain.d.ts +3 -0
  27. package/dist/types/extension-artifacts.d.ts +2 -4
  28. package/dist/types/extension-transport.d.ts +31 -0
  29. package/dist/types/feature-plan.d.ts +67 -0
  30. package/dist/types/index.d.ts +2 -2
  31. package/dist/types/review.d.ts +30 -0
  32. package/dist/types/tooling.d.ts +4 -0
  33. package/dist/types/types.d.ts +9 -1
  34. package/dist/types.js +10 -3
  35. package/docs/AI-AUTHORING.md +466 -0
  36. package/docs/FUNCTION-SECURITY.md +251 -0
  37. package/docs/README.md +96 -0
  38. package/docs/TOOLING.md +422 -0
  39. package/docs/YAML-REFERENCE.md +473 -0
  40. package/examples/assets/example.yaml +3 -3
  41. package/examples/aws/example.yaml +3 -3
  42. package/examples/cloudflare/example.yaml +3 -3
  43. package/examples/compliance/README.md +1 -1
  44. package/examples/compliance/example.yaml +1 -1
  45. package/examples/conditions/example.yaml +3 -3
  46. package/examples/cookbook/README.md +4 -4
  47. package/examples/cookbook/example.yaml +3 -3
  48. package/examples/coverage-waiver/example.yaml +3 -3
  49. package/examples/egress/example.yaml +2 -2
  50. package/examples/extensions/example.yaml +1 -1
  51. package/examples/lifecycle/example.yaml +2 -2
  52. package/examples/not-found/README.md +2 -2
  53. package/examples/not-found/example.yaml +3 -3
  54. package/examples/prerender/README.md +4 -4
  55. package/examples/prerender/example.yaml +2 -2
  56. package/examples/provider-conformance/example.yaml +2 -2
  57. package/examples/shared-blocks/example.yaml +3 -3
  58. package/examples/vercel/example.yaml +3 -3
  59. package/llms-full.txt +119 -84
  60. package/llms.txt +28 -19
  61. package/package.json +19 -13
  62. package/recipes/store-crud/README.md +9 -10
  63. package/recipes/store-crud/recipe.yaml +1 -1
  64. package/schemas/urlcode.schema.json +3 -0
  65. package/skills/urlcode/SKILL.md +1 -1
  66. package/starters/default/AGENTS.md +1 -1
  67. package/starters/default/README.md +2 -2
@@ -0,0 +1,31 @@
1
+ /** Shared GitHub release/cache/lockfile plumbing for extension-artifacts.ts and extension-bundles.ts. No opinion on what content is allowed or executable; that trust boundary stays local to each caller (#441). */
2
+ export type UnknownRecord = Record<string, unknown>;
3
+ export declare const isRecord: (v: unknown) => v is UnknownRecord;
4
+ export declare const digestHex: (bytes: Uint8Array) => string;
5
+ export declare function textField(value: unknown, what: string): string;
6
+ export declare function exactKeys(value: UnknownRecord, expected: readonly string[], what: string): void;
7
+ /** Sorted, recursive listing of an extension cache directory; refuses links and special files. */
8
+ export declare function listCachedFiles(root: string, itemLabel: string, prefix?: string): Promise<string[]>;
9
+ /** Atomic write-then-rename for a JSON lockfile, refusing to clobber a concurrent writer. */
10
+ export declare function writeLockAtomic(path: string, temporary: string, data: unknown): Promise<void>;
11
+ export interface ReleaseAsset {
12
+ name: string;
13
+ url: string;
14
+ }
15
+ export interface GithubTransport {
16
+ release(tag: string): Promise<ReleaseAsset[]>;
17
+ download(url: string): Promise<Uint8Array>;
18
+ attest(path: string, release: string): Promise<void>;
19
+ }
20
+ export interface GithubTransportConfig {
21
+ repository: string;
22
+ workflow: string;
23
+ tagPattern: RegExp;
24
+ exampleTag: string;
25
+ maxAssetSize: number;
26
+ itemLabel: string;
27
+ }
28
+ /** A transport that accepts only GitHub Release asset URLs and verifies every downloaded subject. */
29
+ export declare function createGithubTransport(config: GithubTransportConfig): GithubTransport;
30
+ /** Downloads one named release asset and has the transport attest it before returning its bytes. */
31
+ export declare function verifiedReleaseAsset(assets: ReleaseAsset[], asset: string, release: string, transport: GithubTransport, itemLabel: string, tempPrefix: string): Promise<Uint8Array>;
@@ -0,0 +1,67 @@
1
+ import type { CapabilityName, CapabilityTarget } from './capabilities.ts';
2
+ import type { RuntimeExtension } from './extensions.ts';
3
+ /** The planner is deliberately a small, local projection. It never treats goal
4
+ * text as instructions, opens a host, or reads extension/project source. */
5
+ export declare const featurePlanMaxBytes = 32768;
6
+ export declare const featurePlanMaxGoalLength = 512;
7
+ export interface FeaturePlanOptions {
8
+ target?: string;
9
+ extensions?: readonly RuntimeExtension[] | undefined;
10
+ }
11
+ export interface FeaturePlan {
12
+ format: 1;
13
+ goalTerms: string[];
14
+ target: CapabilityTarget;
15
+ project: {
16
+ routes: number;
17
+ extensions: string[];
18
+ };
19
+ applicable: {
20
+ capabilities: {
21
+ name: CapabilityName;
22
+ support: string;
23
+ reason: string;
24
+ }[];
25
+ recipes: {
26
+ name: string;
27
+ description: string;
28
+ matched: string[];
29
+ }[];
30
+ };
31
+ extensions: {
32
+ required: {
33
+ name: string;
34
+ reason: string;
35
+ declared: boolean;
36
+ registered: boolean;
37
+ target: string;
38
+ artifact: 'none' | 'cached' | 'missing' | 'invalid';
39
+ }[];
40
+ ordering: {
41
+ status: 'operator-resolved';
42
+ names: string[];
43
+ note: string;
44
+ };
45
+ };
46
+ outline: {
47
+ kind: string;
48
+ note: string;
49
+ }[];
50
+ applicationCode: {
51
+ requirement: string;
52
+ reason: string;
53
+ }[];
54
+ unsupported: {
55
+ requirement: string;
56
+ reason: string;
57
+ }[];
58
+ next: string[];
59
+ estimatedTokens: number;
60
+ }
61
+ /**
62
+ * Plans only from the current compiled project, package-owned catalogs, locked
63
+ * inert artifacts, and registrations passed by the already-opened operator
64
+ * session. It intentionally has no filesystem path, host-file, binding, or
65
+ * execution argument.
66
+ */
67
+ export declare function planFeature(project: string, goal: string, options?: FeaturePlanOptions): Promise<FeaturePlan>;
@@ -18,8 +18,8 @@ export { buildTypeScriptProject } from './typescript-authoring.ts';
18
18
  export type { TypeScriptBuildReport } from './typescript-authoring.ts';
19
19
  export { importBulkProject } from './bulk.ts';
20
20
  export type { BulkFormat, BulkFilePlan, BulkImportReport } from './bulk.ts';
21
- export { inspectProject, validateProject, explainRoute, explainProject, previewImport, previewExport, getCapability, getSchemaFragment, schemaPathNames, inspectExtensions, describeExtensions, buildContext, renderContext, estimateTokens, documentationTokens, buildTaskContext, renderTaskContext, contextTasks } from './tooling.ts';
22
- export type { InspectOptions, RouteExplanation, RouteMiss, ExplainedHandler, ExplainedCache, ExplainedExtensionRequirement, ExtensionProvider, TargetSupport, CapabilityEntry, CapabilityUsage, SchemaFragment, ExtensionInspection, ContextOptions, ProjectContext, ContextSection, ContextTask, TaskContext, TaskShape } from './tooling.ts';
21
+ export { inspectProject, validateProject, explainRoute, explainProject, previewImport, previewExport, getCapability, getSchemaFragment, schemaPathNames, inspectExtensions, describeExtensions, buildContext, renderContext, estimateTokens, documentationTokens, buildTaskContext, renderTaskContext, contextTasks, planFeature, featurePlanMaxBytes, featurePlanMaxGoalLength } from './tooling.ts';
22
+ export type { InspectOptions, RouteExplanation, RouteMiss, ExplainedHandler, ExplainedCache, ExplainedExtensionRequirement, ExtensionProvider, TargetSupport, CapabilityEntry, CapabilityUsage, SchemaFragment, ExtensionInspection, ContextOptions, ProjectContext, ContextSection, ContextTask, TaskContext, TaskShape, FeaturePlan, FeaturePlanOptions } from './tooling.ts';
23
23
  export { buildManifest, renderManifest, MANIFEST_SCHEMA_VERSION } from './manifest.ts';
24
24
  export type { Manifest, ManifestRoute, ManifestModule, RecipeProvenance } from './manifest.ts';
25
25
  export { serveMcp } from './mcp.ts';
@@ -0,0 +1,30 @@
1
+ import type { InspectOptions } from './tooling.ts';
2
+ export type ReviewCategory = 'native-alternative' | 'extension-alternative' | 'gap' | 'manual-review';
3
+ export type ReviewSignal = 'manual-body-validation' | 'manual-cookie-session' | 'global-mutable-state' | 'outbound-network-call' | 'method-dispatch' | 'manual-rate-limit' | 'manual-security-headers';
4
+ export interface ReviewObservation {
5
+ category: ReviewCategory;
6
+ signal: ReviewSignal;
7
+ routes: string[];
8
+ source: string;
9
+ line: number;
10
+ confidence: 'low' | 'medium';
11
+ reason: string;
12
+ excerpt: string;
13
+ capability?: 'request.body' | 'proxy' | 'methods' | 'policies.throttle' | 'policies.security';
14
+ extension?: string;
15
+ note: string;
16
+ /** Set only for an extension-alternative observation when the caller supplied operator registrations (InspectOptions.extensions): whether that extension is actually registered, and, if so, whether the registration is pinned to this project's current revision. Absent when registration state could not be determined (no registrations supplied), in which case `note` stays with the conservative "declared, setup unconfirmed" wording. */
17
+ registered?: boolean;
18
+ revisionPinned?: boolean;
19
+ }
20
+ export interface ProjectReview {
21
+ format: 1;
22
+ projectSha256: string;
23
+ routeCount: number;
24
+ moduleCount: number;
25
+ observations: ReviewObservation[];
26
+ summary: Record<ReviewCategory, number>;
27
+ }
28
+ export declare const reviewModuleByteLimit = 1048576;
29
+ export declare const reviewExcerptLimit = 240;
30
+ export declare function reviewProject(project: string, options?: InspectOptions): Promise<ProjectReview>;
@@ -12,7 +12,11 @@ export type { SchemaFragment } from './schema-query.ts';
12
12
  export { listRecipes, showRecipe, searchRecipes, listExamples, searchExamples };
13
13
  export { buildContext, renderContext, estimateTokens, documentationTokens, buildTaskContext, renderTaskContext, contextTasks } from './context.ts';
14
14
  export type { ContextOptions, ProjectContext, ContextSection, ContextTask, TaskContext, TaskShape } from './context.ts';
15
+ export { planFeature, featurePlanMaxBytes, featurePlanMaxGoalLength } from './feature-plan.ts';
16
+ export type { FeaturePlan, FeaturePlanOptions } from './feature-plan.ts';
15
17
  export type { RouteExplanation, ExplainedHandler, ExplainedCache, ExplainedExtensionRequirement, ExtensionProvider, TargetSupport } from './explain.ts';
18
+ export { reviewProject } from './review.ts';
19
+ export type { ProjectReview, ReviewObservation, ReviewCategory, ReviewSignal } from './review.ts';
16
20
  /** `extensions` are operator registrations from a host file; explain reports whether each requirement has a provider. Nothing is activated. */
17
21
  export interface InspectOptions {
18
22
  origin?: string;
@@ -19,10 +19,18 @@ export interface ParameterConfig {
19
19
  required?: boolean;
20
20
  schema: ParameterSchema;
21
21
  }
22
- /** `env` binding: a literal `value`, or the `env` name to read from the process environment. */
22
+ /**
23
+ * `env` binding: a plain literal `value` (always reviewable, never overridden); or the `env`
24
+ * name to read from the process environment, with an optional `default` used when that
25
+ * variable is unset. `env` always requires an operator grant for that route/name — if the
26
+ * grant is missing, a declared `default` is used with no host read attempted (the binding
27
+ * degrades to its literal default rather than failing); with no `default`, a missing grant
28
+ * fails route compilation (docs/yaml/functions.md, "Host overrides").
29
+ */
23
30
  export interface EnvBinding {
24
31
  value?: string;
25
32
  env?: string;
33
+ default?: string;
26
34
  }
27
35
  /** `secrets` binding: the `secret` name to read from the process environment. */
28
36
  export interface SecretBinding {
package/dist/types.js CHANGED
@@ -26,8 +26,15 @@
26
26
 
27
27
  /** One declared input: a path placeholder, a query parameter or a request header. */
28
28
 
29
- /** `env` binding: a literal `value`, or the `env` name to read from the process environment. */
30
-
29
+ /**
30
+ * `env` binding: a plain literal `value` (always reviewable, never overridden); or the `env`
31
+ * name to read from the process environment, with an optional `default` used when that
32
+ * variable is unset. `env` always requires an operator grant for that route/name — if the
33
+ * grant is missing, a declared `default` is used with no host read attempted (the binding
34
+ * degrades to its literal default rather than failing); with no `default`, a missing grant
35
+ * fails route compilation (docs/yaml/functions.md, "Host overrides").
36
+ */
37
+
31
38
  /** `secrets` binding: the `secret` name to read from the process environment. */
32
39
 
33
40
 
@@ -147,7 +154,7 @@
147
154
 
148
155
 
149
156
  // ---------------------------------------------------------------------------
150
- // The host-side policy contract (src/policies.ts documents the phases).
157
+ // The host-side policy contract (packages/core/src/policies.ts documents the phases).
151
158
 
152
159
 
153
160